| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_protocols.h" | 5 #include "extensions/browser/extension_protocols.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info, | 290 bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info, |
| 291 const std::string& extension_id, | 291 const std::string& extension_id, |
| 292 extensions::InfoMap* extension_info_map) { | 292 extensions::InfoMap* extension_info_map) { |
| 293 if (!extension_info_map->IsIncognitoEnabled(extension_id)) | 293 if (!extension_info_map->IsIncognitoEnabled(extension_id)) |
| 294 return false; | 294 return false; |
| 295 | 295 |
| 296 // Only allow incognito toplevel navigations to extension resources in | 296 // Only allow incognito toplevel navigations to extension resources in |
| 297 // split mode. In spanning mode, the extension must run in a single process, | 297 // split mode. In spanning mode, the extension must run in a single process, |
| 298 // and an incognito tab prevents that. | 298 // and an incognito tab prevents that. |
| 299 if (info->GetResourceType() == ResourceType::MAIN_FRAME) { | 299 if (info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) { |
| 300 const Extension* extension = | 300 const Extension* extension = |
| 301 extension_info_map->extensions().GetByID(extension_id); | 301 extension_info_map->extensions().GetByID(extension_id); |
| 302 return extension && extensions::IncognitoInfo::IsSplitMode(extension); | 302 return extension && extensions::IncognitoInfo::IsSplitMode(extension); |
| 303 } | 303 } |
| 304 | 304 |
| 305 return true; | 305 return true; |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Returns true if an chrome-extension:// resource should be allowed to load. | 308 // Returns true if an chrome-extension:// resource should be allowed to load. |
| 309 // Pass true for |is_incognito| only for incognito profiles and not Chrome OS | 309 // Pass true for |is_incognito| only for incognito profiles and not Chrome OS |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 return new net::HttpResponseHeaders(raw_headers); | 568 return new net::HttpResponseHeaders(raw_headers); |
| 569 } | 569 } |
| 570 | 570 |
| 571 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 571 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
| 572 bool is_incognito, | 572 bool is_incognito, |
| 573 extensions::InfoMap* extension_info_map) { | 573 extensions::InfoMap* extension_info_map) { |
| 574 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 574 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
| 575 } | 575 } |
| 576 | 576 |
| 577 } // namespace extensions | 577 } // namespace extensions |
| OLD | NEW |