Bookmark manager: Open in incognito window.
Make IsIncognitoEnabled take an Extension* as an argument as well and use that where possible.
BUG=4890
TEST=Select one more bookmarks and right click/tools and select "Open in incognito". The bookmarks should open in an incognito window.
Review URL: http://codereview.chromium.org/750001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41193 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index b4373ec0..4e9cb548 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -580,16 +580,19 @@
return extension_prefs_->LastPingDay(extension_id);
}
-bool ExtensionsService::IsIncognitoEnabled(const std::string& extension_id) {
- return extension_prefs_->IsIncognitoEnabled(extension_id);
+bool ExtensionsService::IsIncognitoEnabled(const Extension* extension) {
+ // If this is a component extension we always allow it to work in incognito
+ // mode.
+ if (extension->location() == Extension::COMPONENT)
+ return true;
+
+ // Check the prefs.
+ return extension_prefs_->IsIncognitoEnabled(extension->id());
}
-void ExtensionsService::SetIsIncognitoEnabled(const std::string& extension_id,
+void ExtensionsService::SetIsIncognitoEnabled(Extension* extension,
bool enabled) {
- extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled);
-
- Extension* extension = GetExtensionByIdInternal(extension_id, true, true);
- DCHECK(extension);
+ extension_prefs_->SetIsIncognitoEnabled(extension->id(), enabled);
// Broadcast unloaded and loaded events to update browser state.
NotifyExtensionUnloaded(extension);