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

Side by Side Diff: chrome/browser/ui/webui/textfields_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/task_manager_handler.cc ('k') | chrome/browser/ui/webui/tracing_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/textfields_ui.h" 5 #include "chrome/browser/ui/webui/textfields_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
10 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
11 #include "base/string_piece.h" 13 #include "base/string_piece.h"
12 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
16 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
17 #include "grit/browser_resources.h" 19 #include "grit/browser_resources.h"
18 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
19 21
(...skipping 18 matching lines...) Expand all
38 40
39 TextfieldsUIHTMLSource::~TextfieldsUIHTMLSource() {} 41 TextfieldsUIHTMLSource::~TextfieldsUIHTMLSource() {}
40 42
41 /** 43 /**
42 * TextfieldsDOMHandler implementation. 44 * TextfieldsDOMHandler implementation.
43 */ 45 */
44 TextfieldsDOMHandler::TextfieldsDOMHandler() : WebUIMessageHandler() {} 46 TextfieldsDOMHandler::TextfieldsDOMHandler() : WebUIMessageHandler() {}
45 47
46 void TextfieldsDOMHandler::RegisterMessages() { 48 void TextfieldsDOMHandler::RegisterMessages() {
47 web_ui_->RegisterMessageCallback("textfieldValue", 49 web_ui_->RegisterMessageCallback("textfieldValue",
48 NewCallback(this, &TextfieldsDOMHandler::HandleTextfieldValue)); 50 base::Bind(&TextfieldsDOMHandler::HandleTextfieldValue,
51 base::Unretained(this)));
49 } 52 }
50 53
51 void TextfieldsDOMHandler::HandleTextfieldValue(const ListValue* args) { 54 void TextfieldsDOMHandler::HandleTextfieldValue(const ListValue* args) {
52 static_cast<TextfieldsUI*>(web_ui_)->set_text( 55 static_cast<TextfieldsUI*>(web_ui_)->set_text(
53 UTF16ToWideHack(ExtractStringValue(args))); 56 UTF16ToWideHack(ExtractStringValue(args)));
54 } 57 }
55 58
56 /** 59 /**
57 * TextfieldsUI implementation. 60 * TextfieldsUI implementation.
58 */ 61 */
59 TextfieldsUI::TextfieldsUI(TabContents* contents) : ChromeWebUI(contents) { 62 TextfieldsUI::TextfieldsUI(TabContents* contents) : ChromeWebUI(contents) {
60 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler(); 63 TextfieldsDOMHandler* handler = new TextfieldsDOMHandler();
61 AddMessageHandler(handler); 64 AddMessageHandler(handler);
62 handler->Attach(this); 65 handler->Attach(this);
63 66
64 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource(); 67 TextfieldsUIHTMLSource* html_source = new TextfieldsUIHTMLSource();
65 68
66 // Set up the chrome://textfields/ source. 69 // Set up the chrome://textfields/ source.
67 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 70 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
68 profile->GetChromeURLDataManager()->AddDataSource(html_source); 71 profile->GetChromeURLDataManager()->AddDataSource(html_source);
69 } 72 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/task_manager_handler.cc ('k') | chrome/browser/ui/webui/tracing_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698