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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 extension_info_map_->extensions().GetExtensionOrAppByURL(file_url); | 131 extension_info_map_->extensions().GetExtensionOrAppByURL(file_url); |
132 if (!extension) | 132 if (!extension) |
133 return false; | 133 return false; |
134 | 134 |
135 // This is a short-cut which avoids calling a blocking file operation | 135 // This is a short-cut which avoids calling a blocking file operation |
136 // (GetFilePath()), so that this can be called on the IO thread. It only | 136 // (GetFilePath()), so that this can be called on the IO thread. It only |
137 // handles a subset of the urls. | 137 // handles a subset of the urls. |
138 if (!use_blocking_api) { | 138 if (!use_blocking_api) { |
139 if (file_url.SchemeIs(extensions::kExtensionScheme)) { | 139 if (file_url.SchemeIs(extensions::kExtensionScheme)) { |
140 std::string path = file_url.path(); | 140 std::string path = file_url.path(); |
141 TrimString(path, "/", &path); // Remove first slash | 141 base::TrimString(path, "/", &path); // Remove first slash |
142 *file_path = extension->path().AppendASCII(path); | 142 *file_path = extension->path().AppendASCII(path); |
143 return true; | 143 return true; |
144 } | 144 } |
145 return false; | 145 return false; |
146 } | 146 } |
147 | 147 |
148 std::string path = file_url.path(); | 148 std::string path = file_url.path(); |
149 extensions::ExtensionResource resource; | 149 extensions::ExtensionResource resource; |
150 | 150 |
151 if (SharedModuleInfo::IsImportedPath(path)) { | 151 if (SharedModuleInfo::IsImportedPath(path)) { |
(...skipping 22 matching lines...) Expand all Loading... |
174 return false; | 174 return false; |
175 | 175 |
176 // GetFilePath is a blocking function call. | 176 // GetFilePath is a blocking function call. |
177 const base::FilePath resource_file_path = resource.GetFilePath(); | 177 const base::FilePath resource_file_path = resource.GetFilePath(); |
178 if (resource_file_path.empty()) | 178 if (resource_file_path.empty()) |
179 return false; | 179 return false; |
180 | 180 |
181 *file_path = resource_file_path; | 181 *file_path = resource_file_path; |
182 return true; | 182 return true; |
183 } | 183 } |
OLD | NEW |