Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 // the resource is explicitly accessible or fits in a set of exception cases. | 363 // the resource is explicitly accessible or fits in a set of exception cases. |
| 364 // Note: This allows a case where two extensions execute in the same renderer | 364 // Note: This allows a case where two extensions execute in the same renderer |
| 365 // process to request each other's resources. We can't do a more precise | 365 // process to request each other's resources. We can't do a more precise |
| 366 // check, since the renderer can lie about which extension has made the | 366 // check, since the renderer can lie about which extension has made the |
| 367 // request. | 367 // request. |
| 368 if (extension_info_map->process_map().Contains( | 368 if (extension_info_map->process_map().Contains( |
| 369 request->url().host(), info->GetChildID())) { | 369 request->url().host(), info->GetChildID())) { |
| 370 return true; | 370 return true; |
| 371 } | 371 } |
| 372 | 372 |
| 373 // If the request is for navigations, then it should be allowed. The | |
| 374 // navigation logic will properly transfer the navigation to a | |
|
Charlie Reis
2013/11/01 18:47:50
nit: navigation logic in CrossSiteResourceHandler
nasko
2013/11/01 18:49:53
Done.
| |
| 375 // privileged process before it commits. | |
| 376 if (ResourceType::IsFrame(info->GetResourceType())) | |
| 377 return true; | |
| 378 | |
| 373 // Extensions with webview: allow loading certain resources by guest renderers | 379 // Extensions with webview: allow loading certain resources by guest renderers |
| 374 // with privileged partition IDs as specified in the manifest file. | 380 // with privileged partition IDs as specified in the manifest file. |
| 375 ExtensionRendererState* renderer_state = | 381 ExtensionRendererState* renderer_state = |
| 376 ExtensionRendererState::GetInstance(); | 382 ExtensionRendererState::GetInstance(); |
| 377 ExtensionRendererState::WebViewInfo webview_info; | 383 ExtensionRendererState::WebViewInfo webview_info; |
| 378 bool is_guest = renderer_state->GetWebViewInfo(info->GetChildID(), | 384 bool is_guest = renderer_state->GetWebViewInfo(info->GetChildID(), |
| 379 info->GetRouteID(), | 385 info->GetRouteID(), |
| 380 &webview_info); | 386 &webview_info); |
| 381 std::string resource_path = request->url().path(); | 387 std::string resource_path = request->url().path(); |
| 382 if (is_guest && webview_info.allow_chrome_extension_urls && | 388 if (is_guest && webview_info.allow_chrome_extension_urls && |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } |
| OLD | NEW |