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

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: 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..c2f311b3d41b1ed8efda7f64efcdc31b39b8f247 100644
--- a/chrome/browser/ui/webui/settings/appearance_handler.cc
+++ b/chrome/browser/ui/webui/settings/appearance_handler.cc
@@ -44,7 +44,7 @@ void AppearanceHandler::Observe(
switch (type) {
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
base::StringValue event("reset-theme-enabled-changed");
- base::FundamentalValue enabled(QueryResetThemeEnabledState());
+ base::FundamentalValue enabled(ResetThemeEnabled());
web_ui()->CallJavascriptFunction(
"cr.webUIListenerCallback", event, enabled);
break;
@@ -59,15 +59,9 @@ void AppearanceHandler::ResetTheme(const base::ListValue* /* args */) {
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,7 +69,7 @@ void AppearanceHandler::GetResetThemeEnabled(const base::ListValue* args) {
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- base::FundamentalValue enabled(QueryResetThemeEnabledState());
+ base::FundamentalValue enabled(ResetThemeEnabled());
ResolveJavascriptCallback(*callback_id, enabled);
dpapad 2016/03/30 17:15:26 Nit(optional): Maybe Inline local var. ResolveJav
Dan Beam 2016/03/30 23:22:37 Done.
}
« 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