Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: Use code review comments for questions instead of TODOs. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index e98857f9c9c0bdb8713ba965e5d94a789072759b..b812caa0405ea05fa9550037e07b6fb10e8bc64b 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -480,6 +480,7 @@ void ContentSettingsHandler::GetLocalizedValues(
// Zoom levels.
{"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL},
{"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON},
+ {"zoomLevelsIgnoredExplanation", IDS_ZOOMLEVELS_IGNORED_LABEL},
// PDF Plugin filter.
{"pdfTabLabel", IDS_PDF_TAB_LABEL},
{"pdfEnable", IDS_PDF_ENABLE_CHECKBOX},
@@ -612,9 +613,18 @@ void ContentSettingsHandler::InitializeHandler() {
base::Bind(&ContentSettingsHandler::OnZoomLevelChanged,
base::Unretained(this)));
+ Profile* profile = Profile::FromWebUI(web_ui());
+
+ ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs();
+ if (zoom_level_prefs) {
+ default_zoom_scope_subscription_ =
+ zoom_level_prefs->RegisterDefaultZoomScopeCallback(
+ base::Bind(&ContentSettingsHandler::OnZoomScopeChanged,
+ base::Unretained(this)));
+ }
+
flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context));
- Profile* profile = Profile::FromWebUI(web_ui());
observer_.Add(HostContentSettingsMapFactory::GetForProfile(profile));
if (profile->HasOffTheRecordProfile()) {
auto* map = HostContentSettingsMapFactory::GetForProfile(
@@ -632,6 +642,7 @@ void ContentSettingsHandler::InitializePage() {
UpdateAllExceptionsViewsFromModel();
UpdateAllChooserExceptionsViewsFromModel();
UpdateProtectedContentExceptionsButton();
+ UpdateZoomScopeExplanationVisibility();
}
void ContentSettingsHandler::OnContentSettingChanged(
@@ -1404,6 +1415,10 @@ void ContentSettingsHandler::OnZoomLevelChanged(
UpdateZoomLevelsExceptionsView();
}
+void ContentSettingsHandler::OnZoomScopeChanged() {
+ UpdateZoomScopeExplanationVisibility();
+}
+
void ContentSettingsHandler::ShowFlashMediaLink(
LinkType link_type, ContentSettingsType content_type, bool show) {
MediaSettingsInfo::ForOneType& settings =
@@ -1497,4 +1512,16 @@ void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
base::FundamentalValue(enable_exceptions));
}
+void ContentSettingsHandler::UpdateZoomScopeExplanationVisibility() {
+ ChromeZoomLevelPrefs* zoom_level_prefs =
+ Profile::FromWebUI(web_ui())->GetZoomLevelPrefs();
+ base::FundamentalValue per_tab_scope(
+ !(zoom_level_prefs
+ ? zoom_level_prefs->GetZoomScopeIsPerOriginPref()
+ : ChromeZoomLevelPrefs::kZoomScopeSettingDefault));
+
+ web_ui()->CallJavascriptFunctionUnsafe(
+ "ContentSettings.showZoomScopeExplanation", per_tab_scope);
+}
+
} // namespace options

Powered by Google App Engine
This is Rietveld 408576698