Chromium Code Reviews| Index: chrome/browser/extensions/extension_protocols.cc |
| diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc |
| index 55f435470ef8a4b8f9027a034603881f036fbaf6..3bf60739c83a1bd58471f5a825264993ddb17c56 100644 |
| --- a/chrome/browser/extensions/extension_protocols.cc |
| +++ b/chrome/browser/extensions/extension_protocols.cc |
| @@ -165,12 +165,22 @@ class URLRequestExtensionJob : public net::URLRequestFileJob { |
| net::HttpResponseInfo response_info_; |
| }; |
| -bool ExtensionCanLoadInIncognito(const std::string& extension_id, |
| +bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info, |
| + const std::string& extension_id, |
| ExtensionInfoMap* extension_info_map) { |
| - const Extension* extension = |
| - extension_info_map->extensions().GetByID(extension_id); |
| - // Only split-mode extensions can load in incognito profiles. |
| - return extension && extension->incognito_split_mode(); |
| + if (!extension_info_map->IsIncognitoEnabled(extension_id)) |
| + return false; |
| + |
| + // Only allow incognito toplevel navigations to extension resources in |
| + // split mode. In spanning mode, the extension must run in a single process, |
| + // and an incognito tab prevents that. |
| + if (info->GetResourceType() == ResourceType::MAIN_FRAME) { |
|
Aaron Boodman
2012/03/20 02:19:29
Why only the main frame? Shouldn't we prevent all
Matt Perry
2012/03/20 17:27:33
We prevent all resources if the extension is not i
Aaron Boodman
2012/03/21 19:29:44
Ah, I remember. Thanks.
|
| + const Extension* extension = |
| + extension_info_map->extensions().GetByID(extension_id); |
| + return extension && extension->incognito_split_mode(); |
| + } |
| + |
| + return true; |
| } |
| // Returns true if an chrome-extension:// resource should be allowed to load. |
| @@ -189,12 +199,8 @@ bool AllowExtensionResourceLoad(net::URLRequest* request, |
| return true; |
| } |
| - // Don't allow toplevel navigations to extension resources in incognito mode. |
| - // This is because an extension must run in a single process, and an |
| - // incognito tab prevents that. |
| - if (is_incognito && |
| - info->GetResourceType() == ResourceType::MAIN_FRAME && |
| - !ExtensionCanLoadInIncognito(request->url().host(), extension_info_map)) { |
| + if (is_incognito && !ExtensionCanLoadInIncognito(info, request->url().host(), |
| + extension_info_map)) { |
| LOG(ERROR) << "Denying load of " << request->url().spec() << " from " |
| << "incognito tab."; |
| return false; |