| OLD | NEW |
| 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/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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/google/core/browser/google_util.h" | 19 #include "components/google/core/browser/google_util.h" |
| 19 #include "content/public/browser/web_ui.h" | 20 #include "content/public/browser/web_ui.h" |
| 20 | 21 |
| 21 namespace options { | 22 namespace options { |
| 22 | 23 |
| 23 namespace { | |
| 24 | |
| 25 const char kHandlersLearnMoreUrl[] = | |
| 26 "https://support.google.com/chrome/answer/1382847"; | |
| 27 | |
| 28 } // namespace | |
| 29 | |
| 30 HandlerOptionsHandler::HandlerOptionsHandler() { | 24 HandlerOptionsHandler::HandlerOptionsHandler() { |
| 31 } | 25 } |
| 32 | 26 |
| 33 HandlerOptionsHandler::~HandlerOptionsHandler() { | 27 HandlerOptionsHandler::~HandlerOptionsHandler() { |
| 34 } | 28 } |
| 35 | 29 |
| 36 void HandlerOptionsHandler::GetLocalizedValues( | 30 void HandlerOptionsHandler::GetLocalizedValues( |
| 37 base::DictionaryValue* localized_strings) { | 31 base::DictionaryValue* localized_strings) { |
| 38 DCHECK(localized_strings); | 32 DCHECK(localized_strings); |
| 39 | 33 |
| 40 static OptionsStringResource resources[] = { | 34 static OptionsStringResource resources[] = { |
| 41 { "handlers_tab_label", IDS_HANDLERS_TAB_LABEL }, | 35 { "handlers_tab_label", IDS_HANDLERS_TAB_LABEL }, |
| 42 { "handlers_allow", IDS_HANDLERS_ALLOW_RADIO }, | 36 { "handlers_allow", IDS_HANDLERS_ALLOW_RADIO }, |
| 43 { "handlers_block", IDS_HANDLERS_DONOTALLOW_RADIO }, | 37 { "handlers_block", IDS_HANDLERS_DONOTALLOW_RADIO }, |
| 44 { "handlers_type_column_header", IDS_HANDLERS_TYPE_COLUMN_HEADER }, | 38 { "handlers_type_column_header", IDS_HANDLERS_TYPE_COLUMN_HEADER }, |
| 45 { "handlers_site_column_header", IDS_HANDLERS_SITE_COLUMN_HEADER }, | 39 { "handlers_site_column_header", IDS_HANDLERS_SITE_COLUMN_HEADER }, |
| 46 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK }, | 40 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK }, |
| 47 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, | 41 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, |
| 48 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING }, | 42 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING }, |
| 49 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING }, | 43 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING }, |
| 50 }; | 44 }; |
| 51 RegisterTitle(localized_strings, "handlersPage", | 45 RegisterTitle(localized_strings, "handlersPage", |
| 52 IDS_HANDLER_OPTIONS_WINDOW_TITLE); | 46 IDS_HANDLER_OPTIONS_WINDOW_TITLE); |
| 53 RegisterStrings(localized_strings, resources, arraysize(resources)); | 47 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 54 | 48 |
| 55 localized_strings->SetString("handlers_learn_more_url", | 49 localized_strings->SetString("handlers_learn_more_url", |
| 56 kHandlersLearnMoreUrl); | 50 chrome::kLearnMoreRegisterProtocolHandlerURL); |
| 57 } | 51 } |
| 58 | 52 |
| 59 void HandlerOptionsHandler::InitializeHandler() { | 53 void HandlerOptionsHandler::InitializeHandler() { |
| 60 notification_registrar_.Add( | 54 notification_registrar_.Add( |
| 61 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, | 55 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
| 62 content::Source<Profile>(Profile::FromWebUI(web_ui()))); | 56 content::Source<Profile>(Profile::FromWebUI(web_ui()))); |
| 63 } | 57 } |
| 64 | 58 |
| 65 void HandlerOptionsHandler::InitializePage() { | 59 void HandlerOptionsHandler::InitializePage() { |
| 66 UpdateHandlerList(); | 60 UpdateHandlerList(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 int type, | 210 int type, |
| 217 const content::NotificationSource& source, | 211 const content::NotificationSource& source, |
| 218 const content::NotificationDetails& details) { | 212 const content::NotificationDetails& details) { |
| 219 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 213 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
| 220 UpdateHandlerList(); | 214 UpdateHandlerList(); |
| 221 else | 215 else |
| 222 NOTREACHED(); | 216 NOTREACHED(); |
| 223 } | 217 } |
| 224 | 218 |
| 225 } // namespace options | 219 } // namespace options |
| OLD | NEW |