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/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/saved_files_service.h" | 8 #include "apps/saved_files_service.h" |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #include "extensions/browser/view_type_utils.h" | 85 #include "extensions/browser/view_type_utils.h" |
86 #include "extensions/browser/warning_set.h" | 86 #include "extensions/browser/warning_set.h" |
87 #include "extensions/common/constants.h" | 87 #include "extensions/common/constants.h" |
88 #include "extensions/common/extension.h" | 88 #include "extensions/common/extension.h" |
89 #include "extensions/common/extension_icon_set.h" | 89 #include "extensions/common/extension_icon_set.h" |
90 #include "extensions/common/extension_set.h" | 90 #include "extensions/common/extension_set.h" |
91 #include "extensions/common/feature_switch.h" | 91 #include "extensions/common/feature_switch.h" |
92 #include "extensions/common/manifest.h" | 92 #include "extensions/common/manifest.h" |
93 #include "extensions/common/manifest_handlers/background_info.h" | 93 #include "extensions/common/manifest_handlers/background_info.h" |
94 #include "extensions/common/manifest_handlers/incognito_info.h" | 94 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 95 #include "extensions/common/manifest_handlers/options_page_info.h" |
95 #include "extensions/common/permissions/permissions_data.h" | 96 #include "extensions/common/permissions/permissions_data.h" |
96 #include "extensions/common/switches.h" | 97 #include "extensions/common/switches.h" |
97 #include "grit/components_strings.h" | 98 #include "grit/components_strings.h" |
98 #include "ui/base/l10n/l10n_util.h" | 99 #include "ui/base/l10n/l10n_util.h" |
99 | 100 |
100 using base::DictionaryValue; | 101 using base::DictionaryValue; |
101 using base::ListValue; | 102 using base::ListValue; |
102 using content::RenderViewHost; | 103 using content::RenderViewHost; |
103 using content::WebContents; | 104 using content::WebContents; |
104 | 105 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 extension->can_be_incognito_enabled()); | 263 extension->can_be_incognito_enabled()); |
263 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); | 264 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); |
264 extension_data->SetBoolean("allowFileAccess", | 265 extension_data->SetBoolean("allowFileAccess", |
265 util::AllowFileAccess(extension->id(), extension_service_->profile())); | 266 util::AllowFileAccess(extension->id(), extension_service_->profile())); |
266 extension_data->SetBoolean("allow_reload", | 267 extension_data->SetBoolean("allow_reload", |
267 Manifest::IsUnpackedLocation(extension->location())); | 268 Manifest::IsUnpackedLocation(extension->location())); |
268 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); | 269 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); |
269 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); | 270 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); |
270 extension_data->SetBoolean("homepageProvided", | 271 extension_data->SetBoolean("homepageProvided", |
271 ManifestURL::GetHomepageURL(extension).is_valid()); | 272 ManifestURL::GetHomepageURL(extension).is_valid()); |
| 273 extension_data->SetBoolean("options_open_in_tab", |
| 274 OptionsPageInfo::ShouldOpenInTab(extension)); |
272 | 275 |
273 // Add dependent extensions. | 276 // Add dependent extensions. |
274 base::ListValue* dependents_list = new base::ListValue; | 277 base::ListValue* dependents_list = new base::ListValue; |
275 if (extension->is_shared_module()) { | 278 if (extension->is_shared_module()) { |
276 scoped_ptr<ExtensionSet> dependent_extensions = | 279 scoped_ptr<ExtensionSet> dependent_extensions = |
277 extension_service_->shared_module_service()->GetDependentExtensions( | 280 extension_service_->shared_module_service()->GetDependentExtensions( |
278 extension); | 281 extension); |
279 for (ExtensionSet::const_iterator i = dependent_extensions->begin(); | 282 for (ExtensionSet::const_iterator i = dependent_extensions->begin(); |
280 i != dependent_extensions->end(); | 283 i != dependent_extensions->end(); |
281 i++) { | 284 i++) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 ExtensionRegistry::EVERYTHING) && | 886 ExtensionRegistry::EVERYTHING) && |
884 !profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDismissedADTPromo)) { | 887 !profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDismissedADTPromo)) { |
885 promote_apps_dev_tools = true; | 888 promote_apps_dev_tools = true; |
886 } | 889 } |
887 results.SetBoolean("promoteAppsDevTools", promote_apps_dev_tools); | 890 results.SetBoolean("promoteAppsDevTools", promote_apps_dev_tools); |
888 | 891 |
889 bool load_unpacked_disabled = | 892 bool load_unpacked_disabled = |
890 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault(); | 893 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault(); |
891 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); | 894 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); |
892 | 895 |
893 results.SetBoolean( | |
894 "enableEmbeddedExtensionOptions", | |
895 extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()); | |
896 | |
897 web_ui()->CallJavascriptFunction( | 896 web_ui()->CallJavascriptFunction( |
898 "extensions.ExtensionSettings.returnExtensionsData", results); | 897 "extensions.ExtensionSettings.returnExtensionsData", results); |
899 | 898 |
900 MaybeRegisterForNotifications(); | 899 MaybeRegisterForNotifications(); |
901 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", | 900 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", |
902 should_do_verification_check_); | 901 should_do_verification_check_); |
903 if (should_do_verification_check_) { | 902 if (should_do_verification_check_) { |
904 should_do_verification_check_ = false; | 903 should_do_verification_check_ = false; |
905 ExtensionSystem::Get(Profile::FromWebUI(web_ui())) | 904 ExtensionSystem::Get(Profile::FromWebUI(web_ui())) |
906 ->install_verifier() | 905 ->install_verifier() |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 return; // Only one prompt at a time. | 1116 return; // Only one prompt at a time. |
1118 | 1117 |
1119 extension_id_prompting_ = extension_id; | 1118 extension_id_prompting_ = extension_id; |
1120 | 1119 |
1121 GetExtensionUninstallDialog()->ConfirmUninstall(extension); | 1120 GetExtensionUninstallDialog()->ConfirmUninstall(extension); |
1122 } | 1121 } |
1123 | 1122 |
1124 void ExtensionSettingsHandler::HandleOptionsMessage( | 1123 void ExtensionSettingsHandler::HandleOptionsMessage( |
1125 const base::ListValue* args) { | 1124 const base::ListValue* args) { |
1126 const Extension* extension = GetActiveExtension(args); | 1125 const Extension* extension = GetActiveExtension(args); |
1127 if (!extension || ManifestURL::GetOptionsPage(extension).is_empty()) | 1126 if (!extension || OptionsPageInfo::GetOptionsPage(extension).is_empty()) |
1128 return; | 1127 return; |
1129 ExtensionTabUtil::OpenOptionsPage(extension, | 1128 ExtensionTabUtil::OpenOptionsPage(extension, |
1130 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 1129 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
1131 } | 1130 } |
1132 | 1131 |
1133 void ExtensionSettingsHandler::HandlePermissionsMessage( | 1132 void ExtensionSettingsHandler::HandlePermissionsMessage( |
1134 const base::ListValue* args) { | 1133 const base::ListValue* args) { |
1135 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args))); | 1134 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args))); |
1136 CHECK(!extension_id.empty()); | 1135 CHECK(!extension_id.empty()); |
1137 const Extension* extension = | 1136 const Extension* extension = |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 extension_service_->EnableExtension(extension_id); | 1412 extension_service_->EnableExtension(extension_id); |
1414 } else { | 1413 } else { |
1415 ExtensionErrorReporter::GetInstance()->ReportError( | 1414 ExtensionErrorReporter::GetInstance()->ReportError( |
1416 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1415 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
1417 true); // Be noisy. | 1416 true); // Be noisy. |
1418 } | 1417 } |
1419 requirements_checker_.reset(); | 1418 requirements_checker_.reset(); |
1420 } | 1419 } |
1421 | 1420 |
1422 } // namespace extensions | 1421 } // namespace extensions |
OLD | NEW |