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

Side by Side Diff: chrome/browser/ui/webui/settings/appearance_handler.cc

Issue 1635673003: MD Settings: Add helper method for responding to cr.sendWithPromise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/settings/appearance_handler.h" 5 #include "chrome/browser/ui/webui/settings/appearance_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bool is_system_theme = false; 64 bool is_system_theme = false;
65 65
66 // TODO(jhawkins): Handle native/system theme button. 66 // TODO(jhawkins): Handle native/system theme button.
67 67
68 bool is_classic_theme = !is_system_theme && 68 bool is_classic_theme = !is_system_theme &&
69 theme_service->UsingDefaultTheme(); 69 theme_service->UsingDefaultTheme();
70 return base::FundamentalValue(!is_classic_theme); 70 return base::FundamentalValue(!is_classic_theme);
71 } 71 }
72 72
73 void AppearanceHandler::GetResetThemeEnabled(const base::ListValue* args) { 73 void AppearanceHandler::GetResetThemeEnabled(const base::ListValue* args) {
74 CHECK_EQ(2U, args->GetSize()); 74 CHECK_EQ(1U, args->GetSize());
75
76 std::string callbackFn;
77 CHECK(args->GetString(0, &callbackFn));
78 const base::Value* callbackId; 75 const base::Value* callbackId;
Dan Beam 2016/01/27 00:23:57 callback_id
dpapad 2016/01/27 00:45:23 Done.
79 CHECK(args->Get(1, &callbackId)); 76 CHECK(args->Get(0, &callbackId));
80 77
81 base::FundamentalValue enabled(QueryResetThemeEnabledState()); 78 base::FundamentalValue enabled(QueryResetThemeEnabledState());
82 web_ui()->CallJavascriptFunction(callbackFn, *callbackId, enabled); 79 CallJavascriptCallback(web_ui(), *callbackId, enabled);
83 } 80 }
84 81
85 } // namespace settings 82 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698