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

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

Issue 333313004: Fix the bug that webview guest cannot load script of a SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add constructor. Created 6 years, 6 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
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 "chrome/browser/extensions/url_request_util.h" 5 #include "chrome/browser/extensions/url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Check workers so that importScripts works from extension workers. 140 // Check workers so that importScripts works from extension workers.
141 if (extension_info_map->worker_process_map().Contains(request->url().host(), 141 if (extension_info_map->worker_process_map().Contains(request->url().host(),
142 info->GetChildID())) { 142 info->GetChildID())) {
143 return true; 143 return true;
144 } 144 }
145 145
146 // Extensions with webview: allow loading certain resources by guest renderers 146 // Extensions with webview: allow loading certain resources by guest renderers
147 // with privileged partition IDs as specified in the manifest file. 147 // with privileged partition IDs as specified in the manifest file.
148 ExtensionRendererState* renderer_state = 148 ExtensionRendererState* renderer_state =
149 ExtensionRendererState::GetInstance(); 149 ExtensionRendererState::GetInstance();
150 ExtensionRendererState::WebViewInfo webview_info; 150 std::string partition_id;
151 bool is_guest = renderer_state->GetWebViewInfo( 151 bool is_guest =
152 info->GetChildID(), info->GetRouteID(), &webview_info); 152 renderer_state->GetWebViewPartitionID(info->GetChildID(), &partition_id);
153 std::string resource_path = request->url().path(); 153 std::string resource_path = request->url().path();
154 if (is_guest && WebviewInfo::IsResourceWebviewAccessible( 154 if (is_guest && WebviewInfo::IsResourceWebviewAccessible(
155 extension, webview_info.partition_id, resource_path)) { 155 extension, partition_id, resource_path)) {
156 return true; 156 return true;
157 } 157 }
158 158
159 // If the request is for navigations outside of webviews, then it should be 159 // If the request is for navigations outside of webviews, then it should be
160 // allowed. The navigation logic in CrossSiteResourceHandler will properly 160 // allowed. The navigation logic in CrossSiteResourceHandler will properly
161 // transfer the navigation to a privileged process before it commits. 161 // transfer the navigation to a privileged process before it commits.
162 if (ResourceType::IsFrame(info->GetResourceType()) && !is_guest) 162 if (ResourceType::IsFrame(info->GetResourceType()) && !is_guest)
163 return true; 163 return true;
164 164
165 if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition())) 165 if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition()))
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return false; 247 return false;
248 ExtensionRendererState* renderer_state = 248 ExtensionRendererState* renderer_state =
249 ExtensionRendererState::GetInstance(); 249 ExtensionRendererState::GetInstance();
250 ExtensionRendererState::WebViewInfo webview_info; 250 ExtensionRendererState::WebViewInfo webview_info;
251 return renderer_state->GetWebViewInfo( 251 return renderer_state->GetWebViewInfo(
252 info->GetChildID(), info->GetRouteID(), &webview_info); 252 info->GetChildID(), info->GetRouteID(), &webview_info);
253 } 253 }
254 254
255 } // namespace url_request_util 255 } // namespace url_request_util
256 } // namespace extensions 256 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698