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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 inverse_debug_patterns_ = true; | 156 inverse_debug_patterns_ = true; |
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 // Allow chrome:// schema, which is used to filter out the internal |
| 167 // PNaCl translator. Also allow chrome-extension:// schema (which |
| 168 // can have NaCl modules). The default is to disallow these schema |
| 169 // since they can be dangerous in the context of chrome extension |
| 170 // permissions, but they are okay here, for NaCl GDB avoidance. |
| 171 URLPattern pattern(URLPattern::SCHEME_ALL); |
167 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) { | 172 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) { |
168 // If URL pattern has scheme equal to *, Parse method resets valid | 173 // 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 | 174 // 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 | 175 // Parse to re-include chrome-extension and chrome schema. |
171 // manifest files. | |
172 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); | 176 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); |
173 debug_patterns_.push_back(pattern); | 177 debug_patterns_.push_back(pattern); |
174 } | 178 } |
175 } | 179 } |
176 } | 180 } |
177 | 181 |
178 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns( | 182 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns( |
179 const GURL& manifest_url) { | 183 const GURL& manifest_url) { |
180 // Empty patterns are forbidden so we ignore them. | 184 // Empty patterns are forbidden so we ignore them. |
181 if (debug_patterns_.empty()) { | 185 if (debug_patterns_.empty()) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return false; | 258 return false; |
255 | 259 |
256 *file_path = resource_file_path; | 260 *file_path = resource_file_path; |
257 return true; | 261 return true; |
258 } | 262 } |
259 | 263 |
260 content::BrowserPpapiHost::OnKeepaliveCallback | 264 content::BrowserPpapiHost::OnKeepaliveCallback |
261 NaClBrowserDelegateImpl::GetOnKeepaliveCallback() { | 265 NaClBrowserDelegateImpl::GetOnKeepaliveCallback() { |
262 return base::Bind(&OnKeepalive); | 266 return base::Bind(&OnKeepalive); |
263 } | 267 } |
OLD | NEW |