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

Unified Diff: chrome/common/extensions/extension.cc

Issue 10264004: Generate a browser action for any extension which doesn't have a browser or (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index adbaa0a3a2f0a18c23cf72884fec9323ec7de0e4..723881e537c06a9bcad89c423608db8341b60c41 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -2332,6 +2332,11 @@ bool Extension::LoadBrowserAction(string16* error) {
return true;
}
+void Extension::GenerateBrowserAction() {
+ browser_action_.reset(new ExtensionAction(id()));
+ browser_action_->SetTitle(ExtensionAction::kDefaultTabId, name());
Aaron Boodman 2012/04/30 02:37:04 If there's no icon, do we currently display the pu
not at google - send to devlin 2012/04/30 03:18:01 We sure do! I was happy to find this.
+}
+
bool Extension::LoadFileBrowserHandlers(string16* error) {
if (!manifest_->HasKey(keys::kFileBrowserHandlers))
return true;
@@ -3081,6 +3086,19 @@ bool Extension::InitFromValue(int flags, string16* error) {
if (!LoadThemeFeatures(error))
return false;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserActionsForAll) &&
+ !browser_action() &&
+ // It only makes sense to generate brower actions for extensions that are
+ // shown in chrome://extensions.
+ ShouldShowInExtensionSettings() &&
+ // Hosted and platform apps are shown in extension settings, but we don't
+ // want to generate browser actions for those either, since they can't
+ // define browser actions.
+ !is_app()) {
Aaron Boodman 2012/04/30 02:37:04 Consider pulling these checks into GenerateBrowser
not at google - send to devlin 2012/04/30 03:18:01 Yeah, nicer.
+ GenerateBrowserAction();
+ }
+
if (HasMultipleUISurfaces()) {
*error = ASCIIToUTF16(errors::kOneUISurfaceOnly);
return false;
@@ -3645,6 +3663,33 @@ ExtensionInfo::ExtensionInfo(const DictionaryValue* manifest,
extension_manifest.reset(manifest->DeepCopy());
}
+bool Extension::ShouldDisplayInExtensionSettings() const {
+ // Don't show themes since this page's UI isn't really useful for themes.
+ if (is_theme())
+ return false;
+
+ // Don't show component extensions because they are only extensions as an
+ // implementation detail of Chrome.
+ if (location() == Extension::COMPONENT &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kShowComponentExtensionOptions))
+ return false;
+
+ // Always show unpacked extensions and apps.
+ if (location() == Extension::LOAD)
+ return true;
+
+ // Unless they are unpacked, never show hosted apps. Note: We intentionally
+ // show packaged apps and platform apps because there are some pieces of
+ // functionality that are only available in chrome://extensions/ but which
+ // are needed for packaged and platform apps. For example, inspecting
+ // background pages. See http://crbug.com/116134.
+ if (is_hosted_app())
+ return false;
+
+ return true;
+}
+
ExtensionInfo::~ExtensionInfo() {}
Extension::RuntimeData::RuntimeData() {}
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698