Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 518653002: Add the "options_ui" extension manifest field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build issue? Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "extensions/browser/view_type_utils.h" 86 #include "extensions/browser/view_type_utils.h"
87 #include "extensions/browser/warning_set.h" 87 #include "extensions/browser/warning_set.h"
88 #include "extensions/common/constants.h" 88 #include "extensions/common/constants.h"
89 #include "extensions/common/extension.h" 89 #include "extensions/common/extension.h"
90 #include "extensions/common/extension_icon_set.h" 90 #include "extensions/common/extension_icon_set.h"
91 #include "extensions/common/extension_set.h" 91 #include "extensions/common/extension_set.h"
92 #include "extensions/common/feature_switch.h" 92 #include "extensions/common/feature_switch.h"
93 #include "extensions/common/manifest.h" 93 #include "extensions/common/manifest.h"
94 #include "extensions/common/manifest_handlers/background_info.h" 94 #include "extensions/common/manifest_handlers/background_info.h"
95 #include "extensions/common/manifest_handlers/incognito_info.h" 95 #include "extensions/common/manifest_handlers/incognito_info.h"
96 #include "extensions/common/manifest_handlers/options_page_info.h"
96 #include "extensions/common/permissions/permissions_data.h" 97 #include "extensions/common/permissions/permissions_data.h"
97 #include "extensions/common/switches.h" 98 #include "extensions/common/switches.h"
98 #include "grit/components_strings.h" 99 #include "grit/components_strings.h"
99 #include "ui/base/l10n/l10n_util.h" 100 #include "ui/base/l10n/l10n_util.h"
100 101
101 using base::DictionaryValue; 102 using base::DictionaryValue;
102 using base::ListValue; 103 using base::ListValue;
103 using content::RenderViewHost; 104 using content::RenderViewHost;
104 using content::WebContents; 105 using content::WebContents;
105 106
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 extension->can_be_incognito_enabled()); 264 extension->can_be_incognito_enabled());
264 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); 265 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access());
265 extension_data->SetBoolean("allowFileAccess", 266 extension_data->SetBoolean("allowFileAccess",
266 util::AllowFileAccess(extension->id(), extension_service_->profile())); 267 util::AllowFileAccess(extension->id(), extension_service_->profile()));
267 extension_data->SetBoolean("allow_reload", 268 extension_data->SetBoolean("allow_reload",
268 Manifest::IsUnpackedLocation(extension->location())); 269 Manifest::IsUnpackedLocation(extension->location()));
269 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); 270 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
270 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); 271 extension_data->SetBoolean("is_platform_app", extension->is_platform_app());
271 extension_data->SetBoolean("homepageProvided", 272 extension_data->SetBoolean("homepageProvided",
272 ManifestURL::SpecifiedHomepageURL(extension)); 273 ManifestURL::SpecifiedHomepageURL(extension));
274 extension_data->SetBoolean("optionsOpenInTab",
275 OptionsPageInfo::ShouldOpenInTab(extension));
273 276
274 // Add dependent extensions. 277 // Add dependent extensions.
275 base::ListValue* dependents_list = new base::ListValue; 278 base::ListValue* dependents_list = new base::ListValue;
276 if (extension->is_shared_module()) { 279 if (extension->is_shared_module()) {
277 scoped_ptr<ExtensionSet> dependent_extensions = 280 scoped_ptr<ExtensionSet> dependent_extensions =
278 extension_service_->shared_module_service()->GetDependentExtensions( 281 extension_service_->shared_module_service()->GetDependentExtensions(
279 extension); 282 extension);
280 for (ExtensionSet::const_iterator i = dependent_extensions->begin(); 283 for (ExtensionSet::const_iterator i = dependent_extensions->begin();
281 i != dependent_extensions->end(); 284 i != dependent_extensions->end();
282 i++) { 285 i++) {
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 !profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDismissedADTPromo)) { 888 !profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDismissedADTPromo)) {
886 promote_apps_dev_tools = true; 889 promote_apps_dev_tools = true;
887 } 890 }
888 results.SetBoolean("promoteAppsDevTools", promote_apps_dev_tools); 891 results.SetBoolean("promoteAppsDevTools", promote_apps_dev_tools);
889 892
890 const bool load_unpacked_disabled = 893 const bool load_unpacked_disabled =
891 ExtensionManagementFactory::GetForBrowserContext(profile) 894 ExtensionManagementFactory::GetForBrowserContext(profile)
892 ->BlacklistedByDefault(); 895 ->BlacklistedByDefault();
893 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); 896 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled);
894 897
895 results.SetBoolean(
896 "enableEmbeddedExtensionOptions",
897 extensions::FeatureSwitch::embedded_extension_options()->IsEnabled());
898
899 web_ui()->CallJavascriptFunction( 898 web_ui()->CallJavascriptFunction(
900 "extensions.ExtensionSettings.returnExtensionsData", results); 899 "extensions.ExtensionSettings.returnExtensionsData", results);
901 900
902 MaybeRegisterForNotifications(); 901 MaybeRegisterForNotifications();
903 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", 902 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck",
904 should_do_verification_check_); 903 should_do_verification_check_);
905 if (should_do_verification_check_) { 904 if (should_do_verification_check_) {
906 should_do_verification_check_ = false; 905 should_do_verification_check_ = false;
907 ExtensionSystem::Get(Profile::FromWebUI(web_ui())) 906 ExtensionSystem::Get(Profile::FromWebUI(web_ui()))
908 ->install_verifier() 907 ->install_verifier()
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 return; // Only one prompt at a time. 1118 return; // Only one prompt at a time.
1120 1119
1121 extension_id_prompting_ = extension_id; 1120 extension_id_prompting_ = extension_id;
1122 1121
1123 GetExtensionUninstallDialog()->ConfirmUninstall(extension); 1122 GetExtensionUninstallDialog()->ConfirmUninstall(extension);
1124 } 1123 }
1125 1124
1126 void ExtensionSettingsHandler::HandleOptionsMessage( 1125 void ExtensionSettingsHandler::HandleOptionsMessage(
1127 const base::ListValue* args) { 1126 const base::ListValue* args) {
1128 const Extension* extension = GetActiveExtension(args); 1127 const Extension* extension = GetActiveExtension(args);
1129 if (!extension || ManifestURL::GetOptionsPage(extension).is_empty()) 1128 if (!extension || OptionsPageInfo::GetOptionsPage(extension).is_empty())
1130 return; 1129 return;
1131 ExtensionTabUtil::OpenOptionsPage(extension, 1130 ExtensionTabUtil::OpenOptionsPage(extension,
1132 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); 1131 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()));
1133 } 1132 }
1134 1133
1135 void ExtensionSettingsHandler::HandlePermissionsMessage( 1134 void ExtensionSettingsHandler::HandlePermissionsMessage(
1136 const base::ListValue* args) { 1135 const base::ListValue* args) {
1137 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args))); 1136 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args)));
1138 CHECK(!extension_id.empty()); 1137 CHECK(!extension_id.empty());
1139 const Extension* extension = 1138 const Extension* extension =
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 extension_service_->EnableExtension(extension_id); 1414 extension_service_->EnableExtension(extension_id);
1416 } else { 1415 } else {
1417 ExtensionErrorReporter::GetInstance()->ReportError( 1416 ExtensionErrorReporter::GetInstance()->ReportError(
1418 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1417 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1419 true); // Be noisy. 1418 true); // Be noisy.
1420 } 1419 }
1421 requirements_checker_.reset(); 1420 requirements_checker_.reset();
1422 } 1421 }
1423 1422
1424 } // namespace extensions 1423 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698