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

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

Issue 55163006: Allow navigations performed by extensions to pass through AllowExtensionResourceLoad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix webview case. Created 7 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_protocols_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 bool is_guest = renderer_state->GetWebViewInfo(info->GetChildID(), 378 bool is_guest = renderer_state->GetWebViewInfo(info->GetChildID(),
379 info->GetRouteID(), 379 info->GetRouteID(),
380 &webview_info); 380 &webview_info);
381 std::string resource_path = request->url().path(); 381 std::string resource_path = request->url().path();
382 if (is_guest && webview_info.allow_chrome_extension_urls && 382 if (is_guest && webview_info.allow_chrome_extension_urls &&
383 extensions::WebviewInfo::IsResourceWebviewAccessible( 383 extensions::WebviewInfo::IsResourceWebviewAccessible(
384 extension, webview_info.partition_id, resource_path)) { 384 extension, webview_info.partition_id, resource_path)) {
385 return true; 385 return true;
386 } 386 }
387 387
388 // If the request is for navigations outside of webviews, then it should be
389 // allowed. The navigation logic in CrossSiteResourceHandler will properly
390 // transfer the navigation to a privileged process before it commits.
391 if (ResourceType::IsFrame(info->GetResourceType()) && !is_guest)
392 return true;
393
388 if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition())) 394 if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition()))
389 return false; 395 return false;
390 396
391 // The following checks require that we have an actual extension object. If we 397 // The following checks require that we have an actual extension object. If we
392 // don't have it, allow the request handling to continue with the rest of the 398 // don't have it, allow the request handling to continue with the rest of the
393 // checks. 399 // checks.
394 if (!extension) 400 if (!extension)
395 return true; 401 return true;
396 402
397 // Disallow loading of packaged resources for hosted apps. We don't allow 403 // Disallow loading of packaged resources for hosted apps. We don't allow
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 send_cors_header); 595 send_cors_header);
590 } 596 }
591 597
592 } // namespace 598 } // namespace
593 599
594 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( 600 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
595 bool is_incognito, 601 bool is_incognito,
596 ExtensionInfoMap* extension_info_map) { 602 ExtensionInfoMap* extension_info_map) {
597 return new ExtensionProtocolHandler(is_incognito, extension_info_map); 603 return new ExtensionProtocolHandler(is_incognito, extension_info_map);
598 } 604 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_protocols_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698