| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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::Initialize() { | 48 void HandlerOptionsHandler::InitializeHandler() { |
| 49 UpdateHandlerList(); | |
| 50 notification_registrar_.Add( | 49 notification_registrar_.Add( |
| 51 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, | 50 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
| 52 content::Source<Profile>(Profile::FromWebUI(web_ui()))); | 51 content::Source<Profile>(Profile::FromWebUI(web_ui()))); |
| 53 } | 52 } |
| 54 | 53 |
| 54 void HandlerOptionsHandler::InitializePage() { |
| 55 UpdateHandlerList(); |
| 56 } |
| 57 |
| 55 void HandlerOptionsHandler::RegisterMessages() { | 58 void HandlerOptionsHandler::RegisterMessages() { |
| 56 web_ui()->RegisterMessageCallback("clearDefault", | 59 web_ui()->RegisterMessageCallback("clearDefault", |
| 57 base::Bind(&HandlerOptionsHandler::ClearDefault, | 60 base::Bind(&HandlerOptionsHandler::ClearDefault, |
| 58 base::Unretained(this))); | 61 base::Unretained(this))); |
| 59 web_ui()->RegisterMessageCallback("removeHandler", | 62 web_ui()->RegisterMessageCallback("removeHandler", |
| 60 base::Bind(&HandlerOptionsHandler::RemoveHandler, | 63 base::Bind(&HandlerOptionsHandler::RemoveHandler, |
| 61 base::Unretained(this))); | 64 base::Unretained(this))); |
| 62 web_ui()->RegisterMessageCallback("setHandlersEnabled", | 65 web_ui()->RegisterMessageCallback("setHandlersEnabled", |
| 63 base::Bind(&HandlerOptionsHandler::SetHandlersEnabled, | 66 base::Bind(&HandlerOptionsHandler::SetHandlersEnabled, |
| 64 base::Unretained(this))); | 67 base::Unretained(this))); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 int type, | 203 int type, |
| 201 const content::NotificationSource& source, | 204 const content::NotificationSource& source, |
| 202 const content::NotificationDetails& details) { | 205 const content::NotificationDetails& details) { |
| 203 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 206 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
| 204 UpdateHandlerList(); | 207 UpdateHandlerList(); |
| 205 else | 208 else |
| 206 NOTREACHED(); | 209 NOTREACHED(); |
| 207 } | 210 } |
| 208 | 211 |
| 209 } // namespace options2 | 212 } // namespace options2 |
| OLD | NEW |