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

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

Issue 2316383002: PlzNavigate: only allow main frame resource loads for extensions (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // check, since the renderer can lie about which extension has made the 362 // check, since the renderer can lie about which extension has made the
363 // request. 363 // request.
364 if (extension_info_map->process_map().Contains( 364 if (extension_info_map->process_map().Contains(
365 request->url().host(), info->GetChildID())) { 365 request->url().host(), info->GetChildID())) {
366 return true; 366 return true;
367 } 367 }
368 368
369 // PlzNavigate: frame navigations to extensions have already been checked in 369 // PlzNavigate: frame navigations to extensions have already been checked in
370 // the ExtensionNavigationThrottle. 370 // the ExtensionNavigationThrottle.
371 if (info->GetChildID() == -1 && 371 if (info->GetChildID() == -1 &&
372 content::IsResourceTypeFrame(info->GetResourceType()) && 372 info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME &&
373 content::IsBrowserSideNavigationEnabled()) { 373 content::IsBrowserSideNavigationEnabled()) {
374 return true; 374 return true;
375 } 375 }
376 376
377 // Allow the extension module embedder to grant permission for loads. 377 // Allow the extension module embedder to grant permission for loads.
378 if (ExtensionsBrowserClient::Get()->AllowCrossRendererResourceLoad( 378 if (ExtensionsBrowserClient::Get()->AllowCrossRendererResourceLoad(
379 request, is_incognito, extension, extension_info_map)) { 379 request, is_incognito, extension, extension_info_map)) {
380 return true; 380 return true;
381 } 381 }
382 382
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
584 584
585 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> 585 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
586 CreateExtensionProtocolHandler(bool is_incognito, 586 CreateExtensionProtocolHandler(bool is_incognito,
587 extensions::InfoMap* extension_info_map) { 587 extensions::InfoMap* extension_info_map) {
588 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, 588 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito,
589 extension_info_map); 589 extension_info_map);
590 } 590 }
591 591
592 } // namespace extensions 592 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698