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/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
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/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
(...skipping 10 matching lines...) Expand all Loading... |
26 #include "chrome/browser/tab_contents/background_contents.h" | 26 #include "chrome/browser/tab_contents/background_contents.h" |
27 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 27 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/chrome_view_type.h" | 30 #include "chrome/common/chrome_view_type.h" |
31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
32 #include "chrome/common/extensions/extension_icon_set.h" | 32 #include "chrome/common/extensions/extension_icon_set.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 36 #include "content/public/browser/notification_source.h" |
36 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
37 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
38 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
39 #include "content/public/browser/site_instance.h" | 40 #include "content/public/browser/site_instance.h" |
40 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
41 #include "content/public/browser/web_contents_view.h" | 42 #include "content/public/browser/web_contents_view.h" |
42 #include "grit/browser_resources.h" | 43 #include "grit/browser_resources.h" |
43 #include "grit/chromium_strings.h" | 44 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 45 #include "grit/generated_resources.h" |
45 #include "grit/theme_resources.h" | 46 #include "grit/theme_resources.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return extension_uninstall_dialog_.get(); | 260 return extension_uninstall_dialog_.get(); |
260 } | 261 } |
261 | 262 |
262 void ExtensionSettingsHandler::HandleToggleDeveloperMode( | 263 void ExtensionSettingsHandler::HandleToggleDeveloperMode( |
263 const ListValue* args) { | 264 const ListValue* args) { |
264 Profile* profile = Profile::FromWebUI(web_ui()); | 265 Profile* profile = Profile::FromWebUI(web_ui()); |
265 bool developer_mode = | 266 bool developer_mode = |
266 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); | 267 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); |
267 profile->GetPrefs()->SetBoolean( | 268 profile->GetPrefs()->SetBoolean( |
268 prefs::kExtensionsUIDeveloperMode, !developer_mode); | 269 prefs::kExtensionsUIDeveloperMode, !developer_mode); |
269 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableUberPage)) | |
270 HandleRequestExtensionsData(NULL); | |
271 } | 270 } |
272 | 271 |
273 void ExtensionSettingsHandler::HandleInspectMessage(const ListValue* args) { | 272 void ExtensionSettingsHandler::HandleInspectMessage(const ListValue* args) { |
274 std::string render_process_id_str; | 273 std::string render_process_id_str; |
275 std::string render_view_id_str; | 274 std::string render_view_id_str; |
276 int render_process_id; | 275 int render_process_id; |
277 int render_view_id; | 276 int render_view_id; |
278 CHECK_EQ(2U, args->GetSize()); | 277 CHECK_EQ(2U, args->GetSize()); |
279 CHECK(args->GetString(0, &render_process_id_str)); | 278 CHECK(args->GetString(0, &render_process_id_str)); |
280 CHECK(args->GetString(1, &render_view_id_str)); | 279 CHECK(args->GetString(1, &render_view_id_str)); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 web_ui()->CallJavascriptFunction("window.handleFilePathSelected", results); | 507 web_ui()->CallJavascriptFunction("window.handleFilePathSelected", results); |
509 } | 508 } |
510 | 509 |
511 void ExtensionSettingsHandler::MultiFilesSelected( | 510 void ExtensionSettingsHandler::MultiFilesSelected( |
512 const std::vector<FilePath>& files, void* params) { | 511 const std::vector<FilePath>& files, void* params) { |
513 NOTREACHED(); | 512 NOTREACHED(); |
514 } | 513 } |
515 | 514 |
516 void ExtensionSettingsHandler::GetLocalizedValues( | 515 void ExtensionSettingsHandler::GetLocalizedValues( |
517 DictionaryValue* localized_strings) { | 516 DictionaryValue* localized_strings) { |
518 RegisterTitle(localized_strings, "extensionSettings", | |
519 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); | |
520 | |
521 localized_strings->SetString("extensionSettingsVisitWebsite", | 517 localized_strings->SetString("extensionSettingsVisitWebsite", |
522 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); | 518 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); |
523 | 519 |
524 localized_strings->SetString("extensionSettingsDeveloperMode", | 520 localized_strings->SetString("extensionSettingsDeveloperMode", |
525 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK)); | 521 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK)); |
526 localized_strings->SetString("extensionSettingsNoExtensions", | 522 localized_strings->SetString("extensionSettingsNoExtensions", |
527 l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED)); | 523 l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED)); |
528 localized_strings->SetString("extensionSettingsSuggestGallery", | 524 localized_strings->SetString("extensionSettingsSuggestGallery", |
529 l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY, | 525 l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY, |
530 ASCIIToUTF16(google_util::AppendGoogleLocaleParam( | 526 ASCIIToUTF16(google_util::AppendGoogleLocaleParam( |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) | 778 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) |
783 continue; | 779 continue; |
784 | 780 |
785 GURL url = host->GetDelegate()->GetURL(); | 781 GURL url = host->GetDelegate()->GetURL(); |
786 content::RenderProcessHost* process = host->GetProcess(); | 782 content::RenderProcessHost* process = host->GetProcess(); |
787 result->push_back( | 783 result->push_back( |
788 ExtensionPage(url, process->GetID(), host->GetRoutingID(), | 784 ExtensionPage(url, process->GetID(), host->GetRoutingID(), |
789 process->GetBrowserContext()->IsOffTheRecord())); | 785 process->GetBrowserContext()->IsOffTheRecord())); |
790 } | 786 } |
791 } | 787 } |
OLD | NEW |