Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/url_request_util.h" | 5 #include "extensions/browser/url_request_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/browser/resource_request_info.h" | 9 #include "content/public/browser/resource_request_info.h" |
| 10 #include "content/public/common/browser_side_navigation_policy.h" | 10 #include "content/public/common/browser_side_navigation_policy.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 bool AllowCrossRendererResourceLoadHelper(bool is_guest, | 148 bool AllowCrossRendererResourceLoadHelper(bool is_guest, |
| 149 const Extension* extension, | 149 const Extension* extension, |
| 150 const Extension* owner_extension, | 150 const Extension* owner_extension, |
| 151 const std::string& partition_id, | 151 const std::string& partition_id, |
| 152 const std::string& resource_path, | 152 const std::string& resource_path, |
| 153 ui::PageTransition page_transition, | 153 ui::PageTransition page_transition, |
| 154 bool* allowed) { | 154 bool* allowed) { |
| 155 if (is_guest) { | 155 if (is_guest) { |
| 156 // An extension's resources should only be accessible to WebViews owned by | 156 // An extension's resources should only be accessible to WebViews owned by |
| 157 // that extension. | 157 // that extension. |
| 158 if (owner_extension != extension) { | 158 // The only exception is the sign-in extension loaded by |
| 159 // chrome://chrome-signin, which is allowed to load web-accessible resources | |
| 160 // even if the webview that is loading the resource does not belog to the | |
|
Charlie Reis
2017/04/25 16:52:54
nit: belong
msarda
2017/04/26 11:14:35
Done.
| |
| 161 // extension. | |
| 162 bool is_signin_extension = | |
| 163 extension && extension->id() == "mfffpogegjflfpflabcdkioaeobkgjik"; | |
|
Charlie Reis
2017/04/25 16:52:54
Is there a constant we can use here rather than a
msarda
2017/04/26 11:14:35
The constant is defined in https://cs.chromium.org
| |
| 164 if (owner_extension != extension && !is_signin_extension) { | |
|
Charlie Reis
2017/04/25 16:52:54
Devlin: What do you think about whitelisting signi
Devlin
2017/04/26 01:59:37
Lucas knows more about the history of this check t
msarda
2017/04/26 11:14:34
Lucas: Please advise on whether to keep this code
lfg
2017/04/26 16:24:18
We should use the whitelist approach instead of re
Charlie Reis
2017/04/26 20:10:25
Acknowledged.
| |
| 159 *allowed = false; | 165 *allowed = false; |
| 160 return true; | 166 return true; |
| 161 } | 167 } |
| 162 | 168 |
| 163 *allowed = WebviewInfo::IsResourceWebviewAccessible(extension, partition_id, | 169 *allowed = WebviewInfo::IsResourceWebviewAccessible(extension, partition_id, |
| 164 resource_path); | 170 resource_path); |
| 165 return true; | 171 return true; |
| 166 } | 172 } |
| 167 | 173 |
| 168 return false; | 174 return false; |
| 169 } | 175 } |
| 170 | 176 |
| 171 } // namespace url_request_util | 177 } // namespace url_request_util |
| 172 } // namespace extensions | 178 } // namespace extensions |
| OLD | NEW |