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

Side by Side Diff: chrome/browser/ui/webui/chromeos/keyboard_overlay_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
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/chromeos/keyboard_overlay_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h"
6 6
7 #include "base/callback.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
8 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
9 #include "base/values.h" 10 #include "base/values.h"
10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 11 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
11 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 12 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
12 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
15 #include "chrome/common/jstemplate_builder.h" 16 #include "chrome/common/jstemplate_builder.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 KeyboardOverlayHandler::~KeyboardOverlayHandler() { 267 KeyboardOverlayHandler::~KeyboardOverlayHandler() {
267 } 268 }
268 269
269 WebUIMessageHandler* KeyboardOverlayHandler::Attach(WebUI* web_ui) { 270 WebUIMessageHandler* KeyboardOverlayHandler::Attach(WebUI* web_ui) {
270 return WebUIMessageHandler::Attach(web_ui); 271 return WebUIMessageHandler::Attach(web_ui);
271 } 272 }
272 273
273 void KeyboardOverlayHandler::RegisterMessages() { 274 void KeyboardOverlayHandler::RegisterMessages() {
274 DCHECK(web_ui_); 275 DCHECK(web_ui_);
275 web_ui_->RegisterMessageCallback("getInputMethodId", 276 web_ui_->RegisterMessageCallback("getInputMethodId",
276 NewCallback(this, &KeyboardOverlayHandler::GetInputMethodId)); 277 base::Bind(&KeyboardOverlayHandler::GetInputMethodId,
278 base::Unretained(this)));
277 web_ui_->RegisterMessageCallback("getLabelMap", 279 web_ui_->RegisterMessageCallback("getLabelMap",
278 NewCallback(this, &KeyboardOverlayHandler::GetLabelMap)); 280 base::Bind(&KeyboardOverlayHandler::GetLabelMap,
281 base::Unretained(this)));
279 } 282 }
280 283
281 void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) { 284 void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) {
282 chromeos::input_method::InputMethodManager* manager = 285 chromeos::input_method::InputMethodManager* manager =
283 chromeos::input_method::InputMethodManager::GetInstance(); 286 chromeos::input_method::InputMethodManager::GetInstance();
284 const chromeos::input_method::InputMethodDescriptor& descriptor = 287 const chromeos::input_method::InputMethodDescriptor& descriptor =
285 manager->current_input_method(); 288 manager->current_input_method();
286 StringValue param(descriptor.id()); 289 StringValue param(descriptor.id());
287 web_ui_->CallJavascriptFunction("initKeyboardOverlayId", param); 290 web_ui_->CallJavascriptFunction("initKeyboardOverlayId", param);
288 } 291 }
(...skipping 30 matching lines...) Expand all
319 : HtmlDialogUI(contents) { 322 : HtmlDialogUI(contents) {
320 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 323 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
321 KeyboardOverlayHandler* handler = 324 KeyboardOverlayHandler* handler =
322 new KeyboardOverlayHandler(profile); 325 new KeyboardOverlayHandler(profile);
323 AddMessageHandler((handler)->Attach(this)); 326 AddMessageHandler((handler)->Attach(this));
324 KeyboardOverlayUIHTMLSource* html_source = new KeyboardOverlayUIHTMLSource(); 327 KeyboardOverlayUIHTMLSource* html_source = new KeyboardOverlayUIHTMLSource();
325 328
326 // Set up the chrome://keyboardoverlay/ source. 329 // Set up the chrome://keyboardoverlay/ source.
327 profile->GetChromeURLDataManager()->AddDataSource(html_source); 330 profile->GetChromeURLDataManager()->AddDataSource(html_source);
328 } 331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698