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

Side by Side Diff: chrome/browser/ui/webui/flags_ui.cc

Issue 8113018: [web-ui] Migrate RegisterMessageCallback usage to base::bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.cc ('k') | chrome/browser/ui/webui/flash_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/flags_ui.h" 5 #include "chrome/browser/ui/webui/flags_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
9 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "chrome/browser/about_flags.h" 13 #include "chrome/browser/about_flags.h"
12 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
17 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 96
95 // Callback for the "restartBrowser" message. Restores all tabs on restart. 97 // Callback for the "restartBrowser" message. Restores all tabs on restart.
96 void HandleRestartBrowser(const ListValue* args); 98 void HandleRestartBrowser(const ListValue* args);
97 99
98 private: 100 private:
99 DISALLOW_COPY_AND_ASSIGN(FlagsDOMHandler); 101 DISALLOW_COPY_AND_ASSIGN(FlagsDOMHandler);
100 }; 102 };
101 103
102 void FlagsDOMHandler::RegisterMessages() { 104 void FlagsDOMHandler::RegisterMessages() {
103 web_ui_->RegisterMessageCallback("requestFlagsExperiments", 105 web_ui_->RegisterMessageCallback("requestFlagsExperiments",
104 NewCallback(this, &FlagsDOMHandler::HandleRequestFlagsExperiments)); 106 base::Bind(&FlagsDOMHandler::HandleRequestFlagsExperiments,
107 base::Unretained(this)));
105 web_ui_->RegisterMessageCallback("enableFlagsExperiment", 108 web_ui_->RegisterMessageCallback("enableFlagsExperiment",
106 NewCallback(this, &FlagsDOMHandler::HandleEnableFlagsExperimentMessage)); 109 base::Bind(&FlagsDOMHandler::HandleEnableFlagsExperimentMessage,
110 base::Unretained(this)));
107 web_ui_->RegisterMessageCallback("restartBrowser", 111 web_ui_->RegisterMessageCallback("restartBrowser",
108 NewCallback(this, &FlagsDOMHandler::HandleRestartBrowser)); 112 base::Bind(&FlagsDOMHandler::HandleRestartBrowser,
113 base::Unretained(this)));
109 } 114 }
110 115
111 void FlagsDOMHandler::HandleRequestFlagsExperiments(const ListValue* args) { 116 void FlagsDOMHandler::HandleRequestFlagsExperiments(const ListValue* args) {
112 DictionaryValue results; 117 DictionaryValue results;
113 results.Set("flagsExperiments", 118 results.Set("flagsExperiments",
114 about_flags::GetFlagsExperimentsData( 119 about_flags::GetFlagsExperimentsData(
115 g_browser_process->local_state())); 120 g_browser_process->local_state()));
116 results.SetBoolean("needsRestart", 121 results.SetBoolean("needsRestart",
117 about_flags::IsRestartNeededToCommitChanges()); 122 about_flags::IsRestartNeededToCommitChanges());
118 web_ui_->CallJavascriptFunction("returnFlagsExperiments", results); 123 web_ui_->CallJavascriptFunction("returnFlagsExperiments", results);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // static 164 // static
160 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { 165 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() {
161 return ResourceBundle::GetSharedInstance(). 166 return ResourceBundle::GetSharedInstance().
162 LoadDataResourceBytes(IDR_FLAGS); 167 LoadDataResourceBytes(IDR_FLAGS);
163 } 168 }
164 169
165 // static 170 // static
166 void FlagsUI::RegisterPrefs(PrefService* prefs) { 171 void FlagsUI::RegisterPrefs(PrefService* prefs) {
167 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); 172 prefs->RegisterListPref(prefs::kEnabledLabsExperiments);
168 } 173 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.cc ('k') | chrome/browser/ui/webui/flash_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698