OLD | NEW |
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/options/handler_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/handler_options_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
15 | 16 |
16 | 17 |
17 HandlerOptionsHandler::HandlerOptionsHandler() { | 18 HandlerOptionsHandler::HandlerOptionsHandler() { |
18 } | 19 } |
19 | 20 |
20 HandlerOptionsHandler::~HandlerOptionsHandler() { | 21 HandlerOptionsHandler::~HandlerOptionsHandler() { |
21 } | 22 } |
22 | 23 |
(...skipping 11 matching lines...) Expand all Loading... |
34 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, | 35 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, |
35 }; | 36 }; |
36 RegisterTitle(localized_strings, "handlersPage", | 37 RegisterTitle(localized_strings, "handlersPage", |
37 IDS_HANDLER_OPTIONS_WINDOW_TITLE); | 38 IDS_HANDLER_OPTIONS_WINDOW_TITLE); |
38 RegisterStrings(localized_strings, resources, arraysize(resources)); | 39 RegisterStrings(localized_strings, resources, arraysize(resources)); |
39 } | 40 } |
40 | 41 |
41 void HandlerOptionsHandler::Initialize() { | 42 void HandlerOptionsHandler::Initialize() { |
42 UpdateHandlerList(); | 43 UpdateHandlerList(); |
43 notification_registrar_.Add( | 44 notification_registrar_.Add( |
44 this, NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, | 45 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
45 NotificationService::AllSources()); | 46 NotificationService::AllSources()); |
46 } | 47 } |
47 | 48 |
48 void HandlerOptionsHandler::RegisterMessages() { | 49 void HandlerOptionsHandler::RegisterMessages() { |
49 DCHECK(web_ui_); | 50 DCHECK(web_ui_); |
50 web_ui_->RegisterMessageCallback("clearDefault", | 51 web_ui_->RegisterMessageCallback("clearDefault", |
51 NewCallback(this, &HandlerOptionsHandler::ClearDefault)); | 52 NewCallback(this, &HandlerOptionsHandler::ClearDefault)); |
52 web_ui_->RegisterMessageCallback("removeHandler", | 53 web_ui_->RegisterMessageCallback("removeHandler", |
53 NewCallback(this, &HandlerOptionsHandler::RemoveHandler)); | 54 NewCallback(this, &HandlerOptionsHandler::RemoveHandler)); |
54 web_ui_->RegisterMessageCallback("setHandlersEnabled", | 55 web_ui_->RegisterMessageCallback("setHandlersEnabled", |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 string16 title; | 150 string16 title; |
150 bool ok = args->GetString(0, &protocol) && args->GetString(1, &url) && | 151 bool ok = args->GetString(0, &protocol) && args->GetString(1, &url) && |
151 args->GetString(2, &title); | 152 args->GetString(2, &title); |
152 if (!ok) | 153 if (!ok) |
153 return ProtocolHandler::EmptyProtocolHandler(); | 154 return ProtocolHandler::EmptyProtocolHandler(); |
154 return ProtocolHandler::CreateProtocolHandler(UTF16ToUTF8(protocol), | 155 return ProtocolHandler::CreateProtocolHandler(UTF16ToUTF8(protocol), |
155 GURL(UTF16ToUTF8(url)), | 156 GURL(UTF16ToUTF8(url)), |
156 title); | 157 title); |
157 } | 158 } |
158 | 159 |
159 void HandlerOptionsHandler::Observe(NotificationType type, | 160 void HandlerOptionsHandler::Observe(int type, |
160 const NotificationSource& source, | 161 const NotificationSource& source, |
161 const NotificationDetails& details) { | 162 const NotificationDetails& details) { |
162 if (type == NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED) | 163 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
163 UpdateHandlerList(); | 164 UpdateHandlerList(); |
164 else | 165 else |
165 NOTREACHED(); | 166 NOTREACHED(); |
166 } | 167 } |
OLD | NEW |