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

Unified Diff: chrome/browser/ui/webui/settings/appearance_handler.cc

Issue 1839293002: MD Settings: simplify logic for whether themes can be reset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simpler Created 4 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/settings/appearance_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/appearance_handler.cc
diff --git a/chrome/browser/ui/webui/settings/appearance_handler.cc b/chrome/browser/ui/webui/settings/appearance_handler.cc
index d9560170dba7330a3cf8b82c25fa9f2cb7da6d15..dcb34f393213a28e7f5ba3c4b7f578b26c6d8a43 100644
--- a/chrome/browser/ui/webui/settings/appearance_handler.cc
+++ b/chrome/browser/ui/webui/settings/appearance_handler.cc
@@ -43,10 +43,10 @@ void AppearanceHandler::Observe(
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
- base::StringValue event("reset-theme-enabled-changed");
- base::FundamentalValue enabled(QueryResetThemeEnabledState());
web_ui()->CallJavascriptFunction(
- "cr.webUIListenerCallback", event, enabled);
+ "cr.webUIListenerCallback",
+ base::StringValue("reset-theme-enabled-changed"),
+ base::FundamentalValue(ResetThemeEnabled()));
break;
}
default:
@@ -55,19 +55,12 @@ void AppearanceHandler::Observe(
}
void AppearanceHandler::ResetTheme(const base::ListValue* /* args */) {
- Profile* profile = Profile::FromWebUI(web_ui());
- ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme();
+ ThemeServiceFactory::GetForProfile(profile_)->UseDefaultTheme();
}
-base::FundamentalValue AppearanceHandler::QueryResetThemeEnabledState() {
- ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_);
- bool is_system_theme = false;
-
+bool AppearanceHandler::ResetThemeEnabled() const {
// TODO(jhawkins): Handle native/system theme button.
-
- bool is_classic_theme = !is_system_theme &&
- theme_service->UsingDefaultTheme();
- return base::FundamentalValue(!is_classic_theme);
+ return !ThemeServiceFactory::GetForProfile(profile_)->UsingDefaultTheme();
}
void AppearanceHandler::GetResetThemeEnabled(const base::ListValue* args) {
@@ -75,8 +68,8 @@ void AppearanceHandler::GetResetThemeEnabled(const base::ListValue* args) {
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- base::FundamentalValue enabled(QueryResetThemeEnabledState());
- ResolveJavascriptCallback(*callback_id, enabled);
+ ResolveJavascriptCallback(*callback_id,
+ base::FundamentalValue(ResetThemeEnabled()));
}
} // namespace settings
« no previous file with comments | « chrome/browser/ui/webui/settings/appearance_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698