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

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: 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/app_window.h" 8 #include "apps/app_window.h"
9 #include "apps/app_window_registry.h" 9 #include "apps/app_window_registry.h"
10 #include "apps/saved_files_service.h" 10 #include "apps/saved_files_service.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_chrome_style",
not at google - send to devlin 2014/08/29 05:39:23 When would you need to access this?
ericzeng 2014/08/29 16:52:22 I'm not sure, if the UA stylesheet is handled all
ericzeng 2014/08/29 22:08:50 Done.
275 OptionsPageInfo::ChromeStyle(extension));
276 extension_data->SetBoolean("options_open_in_tab",
277 OptionsPageInfo::OpenInTab(extension));
273 278
274 // Add dependent extensions. 279 // Add dependent extensions.
275 base::ListValue* dependents_list = new base::ListValue; 280 base::ListValue* dependents_list = new base::ListValue;
276 if (extension->is_shared_module()) { 281 if (extension->is_shared_module()) {
277 scoped_ptr<ExtensionSet> dependent_extensions = 282 scoped_ptr<ExtensionSet> dependent_extensions =
278 extension_service_->shared_module_service()->GetDependentExtensions( 283 extension_service_->shared_module_service()->GetDependentExtensions(
279 extension); 284 extension);
280 for (ExtensionSet::const_iterator i = dependent_extensions->begin(); 285 for (ExtensionSet::const_iterator i = dependent_extensions->begin();
281 i != dependent_extensions->end(); 286 i != dependent_extensions->end();
282 i++) { 287 i++) {
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 return; // Only one prompt at a time. 1123 return; // Only one prompt at a time.
1119 1124
1120 extension_id_prompting_ = extension_id; 1125 extension_id_prompting_ = extension_id;
1121 1126
1122 GetExtensionUninstallDialog()->ConfirmUninstall(extension); 1127 GetExtensionUninstallDialog()->ConfirmUninstall(extension);
1123 } 1128 }
1124 1129
1125 void ExtensionSettingsHandler::HandleOptionsMessage( 1130 void ExtensionSettingsHandler::HandleOptionsMessage(
1126 const base::ListValue* args) { 1131 const base::ListValue* args) {
1127 const Extension* extension = GetActiveExtension(args); 1132 const Extension* extension = GetActiveExtension(args);
1128 if (!extension || ManifestURL::GetOptionsPage(extension).is_empty()) 1133 if (!extension || OptionsPageInfo::GetOptionsPage(extension).is_empty())
1129 return; 1134 return;
1130 ExtensionTabUtil::OpenOptionsPage(extension, 1135 ExtensionTabUtil::OpenOptionsPage(extension,
1131 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); 1136 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()));
1132 } 1137 }
1133 1138
1134 void ExtensionSettingsHandler::HandlePermissionsMessage( 1139 void ExtensionSettingsHandler::HandlePermissionsMessage(
1135 const base::ListValue* args) { 1140 const base::ListValue* args) {
1136 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args))); 1141 std::string extension_id(base::UTF16ToUTF8(ExtractStringValue(args)));
1137 CHECK(!extension_id.empty()); 1142 CHECK(!extension_id.empty());
1138 const Extension* extension = 1143 const Extension* extension =
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 extension_service_->EnableExtension(extension_id); 1419 extension_service_->EnableExtension(extension_id);
1415 } else { 1420 } else {
1416 ExtensionErrorReporter::GetInstance()->ReportError( 1421 ExtensionErrorReporter::GetInstance()->ReportError(
1417 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1422 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1418 true); // Be noisy. 1423 true); // Be noisy.
1419 } 1424 }
1420 requirements_checker_.reset(); 1425 requirements_checker_.reset();
1421 } 1426 }
1422 1427
1423 } // namespace extensions 1428 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698