summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 23:16:20 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 23:16:20 +0000
commit5ef7b002aff9bd0629c36c3802281251d9cda3d6 (patch)
treea7e3cd95e9852fc45e013f214afb6e60a5c9d60c
parent64158f44192c478dcff8dcceb3847f7e8849a40c (diff)
downloadchromium_src-5ef7b002aff9bd0629c36c3802281251d9cda3d6.zip
chromium_src-5ef7b002aff9bd0629c36c3802281251d9cda3d6.tar.gz
chromium_src-5ef7b002aff9bd0629c36c3802281251d9cda3d6.tar.bz2
Don't show suggestions in the Omnibox (from the Extension App provider) for packaged apps unless the app has Incognito enabled and split mode set to true. Hosted apps should always be able to load in incognito.
BUG=81304 TEST=Install a packaged app from the web store and type its name into the Omnibox of an incognito window. Make sure it does not show up. Now go to chrome://extensions and check 'Allow in incognito' for this extension. Make sure it now shows up in the Omnibox as a suggestion. Review URL: http://codereview.chromium.org/7016005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85209 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/extension_app_provider.cc4
-rw-r--r--chrome/browser/extensions/extension_service.cc9
-rw-r--r--chrome/browser/extensions/extension_service.h3
3 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/extension_app_provider.cc b/chrome/browser/autocomplete/extension_app_provider.cc
index 614cb1f..0abe36b 100644
--- a/chrome/browser/autocomplete/extension_app_provider.cc
+++ b/chrome/browser/autocomplete/extension_app_provider.cc
@@ -95,6 +95,10 @@ void ExtensionAppProvider::RefreshAppList() {
for (ExtensionList::const_iterator app = extensions->begin();
app != extensions->end(); ++app) {
if ((*app)->is_app() && (*app)->GetFullLaunchURL().is_valid()) {
+ if (profile_->IsOffTheRecord() &&
+ !extension_service->CanLoadInIncognito((*app)))
+ continue;
+
extension_apps_.push_back(
std::make_pair((*app)->name(),
(*app)->GetFullLaunchURL().spec()));
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index e9a0d3c..dc29954 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1467,6 +1467,15 @@ bool ExtensionService::CanCrossIncognito(const Extension* extension) {
!extension->incognito_split_mode();
}
+bool ExtensionService::CanLoadInIncognito(const Extension* extension) const {
+ if (extension->is_hosted_app())
+ return true;
+ // Packaged apps and regular extensions need to be enabled specifically for
+ // incognito (and split mode should be set).
+ return extension->incognito_split_mode() &&
+ IsIncognitoEnabled(extension->id());
+}
+
bool ExtensionService::AllowFileAccess(const Extension* extension) {
return (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableExtensionsFileAccessCheck) ||
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 95b3cf3..ff2c599 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -211,6 +211,9 @@ class ExtensionService
// sub-profile (incognito to original profile, or vice versa).
bool CanCrossIncognito(const Extension* extension);
+ // Returns true if the given extension can be loaded in incognito.
+ bool CanLoadInIncognito(const Extension* extension) const;
+
// Whether this extension can inject scripts into pages with file URLs.
bool AllowFileAccess(const Extension* extension);
// Will reload the extension since this permission is applied at loading time