| 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/google/google_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 | 21 |
| 21 namespace options { | 22 namespace options { |
| 22 | 23 |
| 24 namespace { |
| 25 |
| 26 const char kHandlersLearnMoreUrl[] = |
| 27 "https://support.google.com/chromebook/answer/1382847"; |
| 28 |
| 29 } // namespace |
| 30 |
| 23 HandlerOptionsHandler::HandlerOptionsHandler() { | 31 HandlerOptionsHandler::HandlerOptionsHandler() { |
| 24 } | 32 } |
| 25 | 33 |
| 26 HandlerOptionsHandler::~HandlerOptionsHandler() { | 34 HandlerOptionsHandler::~HandlerOptionsHandler() { |
| 27 } | 35 } |
| 28 | 36 |
| 29 void HandlerOptionsHandler::GetLocalizedValues( | 37 void HandlerOptionsHandler::GetLocalizedValues( |
| 30 base::DictionaryValue* localized_strings) { | 38 base::DictionaryValue* localized_strings) { |
| 31 DCHECK(localized_strings); | 39 DCHECK(localized_strings); |
| 32 | 40 |
| 33 static OptionsStringResource resources[] = { | 41 static OptionsStringResource resources[] = { |
| 34 { "handlers_tab_label", IDS_HANDLERS_TAB_LABEL }, | 42 { "handlers_tab_label", IDS_HANDLERS_TAB_LABEL }, |
| 35 { "handlers_allow", IDS_HANDLERS_ALLOW_RADIO }, | 43 { "handlers_allow", IDS_HANDLERS_ALLOW_RADIO }, |
| 36 { "handlers_block", IDS_HANDLERS_DONOTALLOW_RADIO }, | 44 { "handlers_block", IDS_HANDLERS_DONOTALLOW_RADIO }, |
| 37 { "handlers_type_column_header", IDS_HANDLERS_TYPE_COLUMN_HEADER }, | 45 { "handlers_type_column_header", IDS_HANDLERS_TYPE_COLUMN_HEADER }, |
| 38 { "handlers_site_column_header", IDS_HANDLERS_SITE_COLUMN_HEADER }, | 46 { "handlers_site_column_header", IDS_HANDLERS_SITE_COLUMN_HEADER }, |
| 39 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK }, | 47 { "handlers_remove_link", IDS_HANDLERS_REMOVE_HANDLER_LINK }, |
| 40 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, | 48 { "handlers_none_handler", IDS_HANDLERS_NONE_HANDLER }, |
| 41 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING }, | 49 { "handlers_active_heading", IDS_HANDLERS_ACTIVE_HEADING }, |
| 42 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING }, | 50 { "handlers_ignored_heading", IDS_HANDLERS_IGNORED_HEADING }, |
| 43 }; | 51 }; |
| 44 RegisterTitle(localized_strings, "handlersPage", | 52 RegisterTitle(localized_strings, "handlersPage", |
| 45 IDS_HANDLER_OPTIONS_WINDOW_TITLE); | 53 IDS_HANDLER_OPTIONS_WINDOW_TITLE); |
| 46 RegisterStrings(localized_strings, resources, arraysize(resources)); | 54 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 55 |
| 56 localized_strings->SetString( |
| 57 "handlers_learn_more_url", |
| 58 google_util::StringAppendGoogleLocaleParam(kHandlersLearnMoreUrl)); |
| 47 } | 59 } |
| 48 | 60 |
| 49 void HandlerOptionsHandler::InitializeHandler() { | 61 void HandlerOptionsHandler::InitializeHandler() { |
| 50 notification_registrar_.Add( | 62 notification_registrar_.Add( |
| 51 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, | 63 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
| 52 content::Source<Profile>(Profile::FromWebUI(web_ui()))); | 64 content::Source<Profile>(Profile::FromWebUI(web_ui()))); |
| 53 } | 65 } |
| 54 | 66 |
| 55 void HandlerOptionsHandler::InitializePage() { | 67 void HandlerOptionsHandler::InitializePage() { |
| 56 UpdateHandlerList(); | 68 UpdateHandlerList(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 int type, | 213 int type, |
| 202 const content::NotificationSource& source, | 214 const content::NotificationSource& source, |
| 203 const content::NotificationDetails& details) { | 215 const content::NotificationDetails& details) { |
| 204 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 216 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
| 205 UpdateHandlerList(); | 217 UpdateHandlerList(); |
| 206 else | 218 else |
| 207 NOTREACHED(); | 219 NOTREACHED(); |
| 208 } | 220 } |
| 209 | 221 |
| 210 } // namespace options | 222 } // namespace options |
| OLD | NEW |