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

Side by Side Diff: chrome/browser/ui/webui/options2/handler_options_handler2.cc

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options2/handler_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 27 matching lines...) Expand all
38 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK }, 38 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK },
39 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, 39 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER },
40 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING }, 40 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING },
41 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING }, 41 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING },
42 }; 42 };
43 RegisterTitle(localized_strings, "handlersPage", 43 RegisterTitle(localized_strings, "handlersPage",
44 IDS_HANDLER_OPTIONS_WINDOW_TITLE); 44 IDS_HANDLER_OPTIONS_WINDOW_TITLE);
45 RegisterStrings(localized_strings, resources, arraysize(resources)); 45 RegisterStrings(localized_strings, resources, arraysize(resources));
46 } 46 }
47 47
48 void HandlerOptionsHandler::InitializeHandler() { 48 void HandlerOptionsHandler::InitializePage() {
49 notification_registrar_.Add( 49 notification_registrar_.Add(
50 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, 50 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
51 content::Source<Profile>(Profile::FromWebUI(web_ui()))); 51 content::Source<Profile>(Profile::FromWebUI(web_ui())));
52 }
53
54 void HandlerOptionsHandler::InitializePage() {
55 UpdateHandlerList(); 52 UpdateHandlerList();
56 } 53 }
57 54
58 void HandlerOptionsHandler::RegisterMessages() { 55 void HandlerOptionsHandler::RegisterMessages() {
59 web_ui()->RegisterMessageCallback("clearDefault", 56 web_ui()->RegisterMessageCallback("clearDefault",
60 base::Bind(&HandlerOptionsHandler::ClearDefault, 57 base::Bind(&HandlerOptionsHandler::ClearDefault,
61 base::Unretained(this))); 58 base::Unretained(this)));
62 web_ui()->RegisterMessageCallback("removeHandler", 59 web_ui()->RegisterMessageCallback("removeHandler",
63 base::Bind(&HandlerOptionsHandler::RemoveHandler, 60 base::Bind(&HandlerOptionsHandler::RemoveHandler,
64 base::Unretained(this))); 61 base::Unretained(this)));
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 int type, 200 int type,
204 const content::NotificationSource& source, 201 const content::NotificationSource& source,
205 const content::NotificationDetails& details) { 202 const content::NotificationDetails& details) {
206 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) 203 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED)
207 UpdateHandlerList(); 204 UpdateHandlerList();
208 else 205 else
209 NOTREACHED(); 206 NOTREACHED();
210 } 207 }
211 208
212 } // namespace options2 209 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698