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

Side by Side Diff: chrome/browser/nacl_host/nacl_browser_delegate_impl.cc

Issue 831813004: Get nacl building again for android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment out CheckEnvVar Created 5 years, 10 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 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 "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" 10 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 std::string NaClBrowserDelegateImpl::GetVersionString() const { 134 std::string NaClBrowserDelegateImpl::GetVersionString() const {
135 return chrome::VersionInfo().CreateVersionString(); 135 return chrome::VersionInfo().CreateVersionString();
136 } 136 }
137 137
138 ppapi::host::HostFactory* NaClBrowserDelegateImpl::CreatePpapiHostFactory( 138 ppapi::host::HostFactory* NaClBrowserDelegateImpl::CreatePpapiHostFactory(
139 content::BrowserPpapiHost* ppapi_host) { 139 content::BrowserPpapiHost* ppapi_host) {
140 return new chrome::ChromeBrowserPepperHostFactory(ppapi_host); 140 return new chrome::ChromeBrowserPepperHostFactory(ppapi_host);
141 } 141 }
142 142
143 void NaClBrowserDelegateImpl::SetDebugPatterns(std::string debug_patterns) { 143 void NaClBrowserDelegateImpl::SetDebugPatterns(
144 if (!debug_patterns.empty() && debug_patterns[0] == '!') { 144 const std::string& debug_patterns) {
145 inverse_debug_patterns_ = true; 145 #if defined(ENABLE_EXTENSIONS)
146 debug_patterns.erase(0, 1);
147 }
148 if (debug_patterns.empty()) { 146 if (debug_patterns.empty()) {
149 return; 147 return;
150 } 148 }
151 std::vector<std::string> patterns; 149 std::vector<std::string> patterns;
152 base::SplitString(debug_patterns, ',', &patterns); 150 if (debug_patterns[0] == '!') {
151 std::string negated_patterns = debug_patterns;
152 inverse_debug_patterns_ = true;
153 negated_patterns.erase(0, 1);
154 base::SplitString(negated_patterns, ',', &patterns);
155 } else {
156 base::SplitString(debug_patterns, ',', &patterns);
157 }
153 for (std::vector<std::string>::iterator iter = patterns.begin(); 158 for (std::vector<std::string>::iterator iter = patterns.begin();
154 iter != patterns.end(); ++iter) { 159 iter != patterns.end(); ++iter) {
155 // Allow chrome:// schema, which is used to filter out the internal 160 // Allow chrome:// schema, which is used to filter out the internal
156 // PNaCl translator. Also allow chrome-extension:// schema (which 161 // PNaCl translator. Also allow chrome-extension:// schema (which
157 // can have NaCl modules). The default is to disallow these schema 162 // can have NaCl modules). The default is to disallow these schema
158 // since they can be dangerous in the context of chrome extension 163 // since they can be dangerous in the context of chrome extension
159 // permissions, but they are okay here, for NaCl GDB avoidance. 164 // permissions, but they are okay here, for NaCl GDB avoidance.
160 URLPattern pattern(URLPattern::SCHEME_ALL); 165 URLPattern pattern(URLPattern::SCHEME_ALL);
161 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) { 166 if (pattern.Parse(*iter) == URLPattern::PARSE_SUCCESS) {
162 // If URL pattern has scheme equal to *, Parse method resets valid 167 // If URL pattern has scheme equal to *, Parse method resets valid
163 // schemes mask to http and https only, so we need to reset it after 168 // schemes mask to http and https only, so we need to reset it after
164 // Parse to re-include chrome-extension and chrome schema. 169 // Parse to re-include chrome-extension and chrome schema.
165 pattern.SetValidSchemes(URLPattern::SCHEME_ALL); 170 pattern.SetValidSchemes(URLPattern::SCHEME_ALL);
166 debug_patterns_.push_back(pattern); 171 debug_patterns_.push_back(pattern);
167 } 172 }
168 } 173 }
174 #endif // defined(ENABLE_EXTENSIONS)
169 } 175 }
170 176
171 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns( 177 bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns(
172 const GURL& manifest_url) { 178 const GURL& manifest_url) {
179 #if defined(ENABLE_EXTENSIONS)
173 // Empty patterns are forbidden so we ignore them. 180 // Empty patterns are forbidden so we ignore them.
174 if (debug_patterns_.empty()) { 181 if (debug_patterns_.empty()) {
175 return true; 182 return true;
176 } 183 }
177 bool matches = false; 184 bool matches = false;
178 for (std::vector<URLPattern>::iterator iter = debug_patterns_.begin(); 185 for (std::vector<URLPattern>::iterator iter = debug_patterns_.begin();
179 iter != debug_patterns_.end(); ++iter) { 186 iter != debug_patterns_.end(); ++iter) {
180 if (iter->MatchesURL(manifest_url)) { 187 if (iter->MatchesURL(manifest_url)) {
181 matches = true; 188 matches = true;
182 break; 189 break;
183 } 190 }
184 } 191 }
185 if (inverse_debug_patterns_) { 192 if (inverse_debug_patterns_) {
186 return !matches; 193 return !matches;
187 } else { 194 } else {
188 return matches; 195 return matches;
189 } 196 }
197 #else
198 return false;
199 #endif // defined(ENABLE_EXTENSIONS)
190 } 200 }
191 201
192 // This function is security sensitive. Be sure to check with a security 202 // This function is security sensitive. Be sure to check with a security
193 // person before you modify it. 203 // person before you modify it.
194 bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath( 204 bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath(
195 const GURL& file_url, 205 const GURL& file_url,
196 bool use_blocking_api, 206 bool use_blocking_api,
197 const base::FilePath& profile_directory, 207 const base::FilePath& profile_directory,
198 base::FilePath* file_path) { 208 base::FilePath* file_path) {
199 #if defined(ENABLE_EXTENSIONS) 209 #if defined(ENABLE_EXTENSIONS)
(...skipping 29 matching lines...) Expand all
229 const base::FilePath& profile_directory) { 239 const base::FilePath& profile_directory) {
230 // Get the profile associated with the renderer. 240 // Get the profile associated with the renderer.
231 Profile* profile = profile_manager_->GetProfileByPath(profile_directory); 241 Profile* profile = profile_manager_->GetProfileByPath(profile_directory);
232 DCHECK(profile); 242 DCHECK(profile);
233 scoped_refptr<extensions::InfoMap> extension_info_map = 243 scoped_refptr<extensions::InfoMap> extension_info_map =
234 extensions::ExtensionSystem::Get(profile)->info_map(); 244 extensions::ExtensionSystem::Get(profile)->info_map();
235 DCHECK(extension_info_map.get()); 245 DCHECK(extension_info_map.get());
236 return extension_info_map; 246 return extension_info_map;
237 } 247 }
238 #endif 248 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698