Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes for DeAMP #12999

Merged
merged 4 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
sub-label="$i18n{statsUsagePingEnabledDesc}"
on-settings-boolean-control-change="onStatsUsagePingEnabledChange_">
</settings-toggle-button>
<settings-toggle-button
class="cr-row"
pref="{{prefs.brave.de_amp.enabled}}"
label="$i18n{deAmpSettingLabel}"
sub-label="$i18n{deAmpSettingSubLabel}">
</settings-toggle-button>
</template>
<script src="brave_personalization_options.js"></script>
</dom-module>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@
pref="{{prefs.brave.shields.stats_badge_visible}}"
label="$i18n{showStatsBlockedBadgeLabel}">
</settings-toggle-button>
<settings-toggle-button
class="cr-row"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix the indentation here, rest everything looks good and all CI passed.

pref="{{prefs.brave.de_amp.enabled}}"
label="$i18n{deAmpSettingLabel}"
sub-label="$i18n{deAmpSettingSubLabel}">
</settings-toggle-button>
<settings-toggle-button
class="cr-row"
pref="{{prefs.brave.reduce_language}}"
label="$i18n{reduceLanguageControlLabel}"
sub-label="$i18n{reduceLanguageDesc}">
</settings-toggle-button>
<div class="settings-box">
<div class="start">$i18n{adControlLabel}</div>
<select id="adControlType" class="md-select"
Expand Down Expand Up @@ -104,12 +116,6 @@
</template>
</select>
</div>
<settings-toggle-button
class="cr-row"
pref="{{prefs.brave.reduce_language}}"
label="$i18n{reduceLanguageControlLabel}"
sub-label="$i18n{reduceLanguageDesc}">
</settings-toggle-button>
</template>
<script src="default_brave_shields_page.js"></script>
</dom-module>
5 changes: 3 additions & 2 deletions components/de_amp/browser/de_amp_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ namespace {
// Check for "amp" or "⚡" in <html> tag
// https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/?format=websites#ampd
constexpr char kGetHtmlTagPattern[] = "(<\\s*?html\\s.*?>)";
constexpr char kDetectAmpPattern[] = "(?:<.*\\s.*(amp|⚡)(?:\\s.*>|>|/>))";
constexpr char kDetectAmpPattern[] =
"(?:<.*?\\s.*?(amp|⚡|amp=\"\\s*\"|amp='\\s*')(?:\\s.*?>|>|/>))";
// Look for canonical link tag and get href
// https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/?format=websites#canon
constexpr char kFindCanonicalLinkTagPattern[] =
"(<\\s*link\\s[^>]*rel=(?:\"|')canonical(?:\"|')(?:\\s[^>]*>|>|/>))";
"(<\\s*?link\\s[^>]*?rel=(?:\"|')canonical(?:\"|')(?:\\s[^>]*?>|>|/>))";
constexpr char kFindCanonicalHrefInTagPattern[] = "href=(?:\"|')(.*?)(?:\"|')";
} // namespace

Expand Down