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

Side by Side Diff: extensions/browser/info_map.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
« no previous file with comments | « extensions/browser/extension_protocols.cc ('k') | extensions/browser/url_request_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/info_map.h" 5 #include "extensions/browser/info_map.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "extensions/browser/content_verifier.h" 9 #include "extensions/browser/content_verifier.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Check that the URL is recognized by the extension system. 160 // Check that the URL is recognized by the extension system.
161 const Extension* extension = extensions_.GetExtensionOrAppByURL(file_url); 161 const Extension* extension = extensions_.GetExtensionOrAppByURL(file_url);
162 if (!extension) 162 if (!extension)
163 return false; 163 return false;
164 164
165 // This is a short-cut which avoids calling a blocking file operation 165 // This is a short-cut which avoids calling a blocking file operation
166 // (GetFilePath()), so that this can be called on the IO thread. It only 166 // (GetFilePath()), so that this can be called on the IO thread. It only
167 // handles a subset of the urls. 167 // handles a subset of the urls.
168 if (!use_blocking_api) { 168 if (!use_blocking_api) {
169 if (file_url.SchemeIs(extensions::kExtensionScheme)) { 169 if (file_url.SchemeIs(extensions::kExtensionScheme)) {
170 std::string path = file_url.path(); 170 std::string path = file_url.path().as_string();
171 base::TrimString(path, "/", &path); // Remove first slash 171 base::TrimString(path, "/", &path); // Remove first slash
172 *file_path = extension->path().AppendASCII(path); 172 *file_path = extension->path().AppendASCII(path);
173 return true; 173 return true;
174 } 174 }
175 return false; 175 return false;
176 } 176 }
177 177
178 std::string path = file_url.path(); 178 std::string path = file_url.path().as_string();
179 ExtensionResource resource; 179 ExtensionResource resource;
180 180
181 if (SharedModuleInfo::IsImportedPath(path)) { 181 if (SharedModuleInfo::IsImportedPath(path)) {
182 // Check if this is a valid path that is imported for this extension. 182 // Check if this is a valid path that is imported for this extension.
183 std::string new_extension_id; 183 std::string new_extension_id;
184 std::string new_relative_path; 184 std::string new_relative_path;
185 SharedModuleInfo::ParseImportedPath( 185 SharedModuleInfo::ParseImportedPath(
186 path, &new_extension_id, &new_relative_path); 186 path, &new_extension_id, &new_relative_path);
187 const Extension* new_extension = extensions_.GetByID(new_extension_id); 187 const Extension* new_extension = extensions_.GetByID(new_extension_id);
188 if (!new_extension) 188 if (!new_extension)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 InfoMap::~InfoMap() { 239 InfoMap::~InfoMap() {
240 if (quota_service_) { 240 if (quota_service_) {
241 BrowserThread::DeleteSoon( 241 BrowserThread::DeleteSoon(
242 BrowserThread::IO, FROM_HERE, quota_service_.release()); 242 BrowserThread::IO, FROM_HERE, quota_service_.release());
243 } 243 }
244 } 244 }
245 245
246 } // namespace extensions 246 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_protocols.cc ('k') | extensions/browser/url_request_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698