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

Side by Side Diff: extensions/browser/extension_protocols.cc

Issue 425653002: content: ResourceType cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | extensions/browser/extension_protocols_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698