Skip to content

Commit

Permalink
Merge pull request #13080 from brave/1.38.x-de-amp-misc-fixes
Browse files Browse the repository at this point in the history
Uplift - Misc fixes for DeAMP (#12999)
  • Loading branch information
kjozwiak authored Apr 22, 2022
2 parents 0eb3146 + d3665fa commit 2a4059e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,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,12 @@
pref="{{prefs.brave.shields.stats_badge_visible}}"
label="$i18n{showStatsBlockedBadgeLabel}">
</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>
<div class="settings-box">
<div class="start">$i18n{adControlLabel}</div>
<select id="adControlType" class="md-select"
Expand Down
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 @@ -18,11 +18,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

0 comments on commit 2a4059e

Please sign in to comment.