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

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 everything 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/browser_resources.h" 98 #include "grit/browser_resources.h"
98 #include "grit/theme_resources.h" 99 #include "grit/theme_resources.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;
(...skipping 158 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::GetHomepageURL(extension).is_valid()); 273 ManifestURL::GetHomepageURL(extension).is_valid());
274 extension_data->SetBoolean("options_open_in_tab",
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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 ExtensionRegistry::EVERYTHING) && 887 ExtensionRegistry::EVERYTHING) &&
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 bool load_unpacked_disabled = 893 bool load_unpacked_disabled =
891 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault(); 894 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault();
892 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); 895 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled);
893 896
894 results.SetBoolean(
895 "enableEmbeddedExtensionOptions",
896 extensions::FeatureSwitch::embedded_extension_options()->IsEnabled());
897
898 web_ui()->CallJavascriptFunction( 897 web_ui()->CallJavascriptFunction(
899 "extensions.ExtensionSettings.returnExtensionsData", results); 898 "extensions.ExtensionSettings.returnExtensionsData", results);
900 899
901 MaybeRegisterForNotifications(); 900 MaybeRegisterForNotifications();
902 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", 901 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck",
903 should_do_verification_check_); 902 should_do_verification_check_);
904 if (should_do_verification_check_) { 903 if (should_do_verification_check_) {
905 should_do_verification_check_ = false; 904 should_do_verification_check_ = false;
906 ExtensionSystem::Get(Profile::FromWebUI(web_ui())) 905 ExtensionSystem::Get(Profile::FromWebUI(web_ui()))
907 ->install_verifier() 906 ->install_verifier()
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 return; // Only one prompt at a time. 1117 return; // Only one prompt at a time.
1119 1118
1120 extension_id_prompting_ = extension_id; 1119 extension_id_prompting_ = extension_id;
1121 1120
1122 GetExtensionUninstallDialog()->ConfirmUninstall(extension); 1121 GetExtensionUninstallDialog()->ConfirmUninstall(extension);
1123 } 1122 }
1124 1123
1125 void ExtensionSettingsHandler::HandleOptionsMessage( 1124 void ExtensionSettingsHandler::HandleOptionsMessage(
1126 const base::ListValue* args) { 1125 const base::ListValue* args) {
1127 const Extension* extension = GetActiveExtension(args); 1126 const Extension* extension = GetActiveExtension(args);
1128 if (!extension || ManifestURL::GetOptionsPage(extension).is_empty()) 1127 if (!extension || OptionsPageInfo::GetOptionsPage(extension).is_empty())
1129 return; 1128 return;
1130 ExtensionTabUtil::OpenOptionsPage(extension, 1129 ExtensionTabUtil::OpenOptionsPage(extension,
1131 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); 1130 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()));
1132 } 1131 }
1133 1132
1134 void ExtensionSettingsHandler::HandlePermissionsMessage( 1133 void ExtensionSettingsHandler::HandlePermissionsMessage(
1135 const base::ListValue* args) { 1134 const base::ListValue* args) {
1136 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args))); 1135 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args)));
1137 CHECK(!extension_id.empty()); 1136 CHECK(!extension_id.empty());
1138 const Extension* extension = 1137 const Extension* extension =
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 extension_service_->EnableExtension(extension_id); 1413 extension_service_->EnableExtension(extension_id);
1415 } else { 1414 } else {
1416 ExtensionErrorReporter::GetInstance()->ReportError( 1415 ExtensionErrorReporter::GetInstance()->ReportError(
1417 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1416 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1418 true); // Be noisy. 1417 true); // Be noisy.
1419 } 1418 }
1420 requirements_checker_.reset(); 1419 requirements_checker_.reset();
1421 } 1420 }
1422 1421
1423 } // namespace extensions 1422 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698