OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/nacl_host/nacl_browser_delegate_impl.h" | 5 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 debug_patterns.erase(0, 1); | 157 debug_patterns.erase(0, 1); |
158 } | 158 } |
159 if (debug_patterns.empty()) { | 159 if (debug_patterns.empty()) { |
160 return; | 160 return; |
161 } | 161 } |
162 std::vector<std::string> patterns; | 162 std::vector<std::string> patterns; |
163 base::SplitString(debug_patterns, ',', &patterns); | 163 base::SplitString(debug_patterns, ',', &patterns); |
164 for (std::vector<std::string>::iterator iter = patterns.begin(); | 164 for (std::vector<std::string>::iterator iter = patterns.begin(); |
165 iter != patterns.end(); ++iter) { | 165 iter != patterns.end(); ++iter) { |
166 URLPattern pattern; | 166 URLPattern pattern; |
167 // Allow chrome:// schema, which is used to filter out the internal | |
168 // PNaCl translator. Also allow chrome-extension:// schema (which | |
169 // can have NaCl modules). The default is to disallow these schema | |
170 // since they can be dangerous in the context of chrome extension | |
171 // permissions, but they are okay here, for NaCl GDB avoidance. | |
172 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); | |
teravest
2014/02/25 18:51:29
I'm confused. Why do you want to set the scheme he
jvoung (off chromium)
2014/02/25 23:52:31
Yes, the problem is that Parse() would otherwise f
| |
167 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) { | 173 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) { |
168 // If URL pattern has scheme equal to *, Parse method resets valid | 174 // If URL pattern has scheme equal to *, Parse method resets valid |
169 // schemes mask to http and https only, so we need to reset it after | 175 // schemes mask to http and https only, so we need to reset it after |
170 // Parse to include chrome-extension scheme that can be used by NaCl | 176 // Parse to re-include chrome-extension and chrome schema. |
171 // manifest files. | |
172 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); | 177 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); |
173 debug_patterns_.push_back(pattern); | 178 debug_patterns_.push_back(pattern); |
174 } | 179 } |
175 } | 180 } |
176 } | 181 } |
177 | 182 |
178 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns( | 183 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns( |
179 const GURL& manifest_url) { | 184 const GURL& manifest_url) { |
180 // Empty patterns are forbidden so we ignore them. | 185 // Empty patterns are forbidden so we ignore them. |
181 if (debug_patterns_.empty()) { | 186 if (debug_patterns_.empty()) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 return false; | 259 return false; |
255 | 260 |
256 *file_path = resource_file_path; | 261 *file_path = resource_file_path; |
257 return true; | 262 return true; |
258 } | 263 } |
259 | 264 |
260 content::BrowserPpapiHost::OnKeepaliveCallback | 265 content::BrowserPpapiHost::OnKeepaliveCallback |
261 NaClBrowserDelegateImpl::GetOnKeepaliveCallback() { | 266 NaClBrowserDelegateImpl::GetOnKeepaliveCallback() { |
262 return base::Bind(&OnKeepalive); | 267 return base::Bind(&OnKeepalive); |
263 } | 268 } |
OLD | NEW |