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

Side by Side Diff: chrome/browser/extensions/extension_protocols.cc

Issue 9320059: Define FilePath::NormalizePathSeparators on all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 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 | Annotate | Revision Log
« no previous file with comments | « base/file_path_unittest.cc ('k') | chrome/browser/extensions/extension_service_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) { 279 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) {
280 return new GeneratedBackgroundPageJob( 280 return new GeneratedBackgroundPageJob(
281 request, extension, content_security_policy); 281 request, extension, content_security_policy);
282 } 282 }
283 283
284 FilePath resources_path; 284 FilePath resources_path;
285 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) && 285 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) &&
286 directory_path.DirName() == resources_path) { 286 directory_path.DirName() == resources_path) {
287 FilePath relative_path = directory_path.BaseName().Append( 287 FilePath relative_path = directory_path.BaseName().Append(
288 extension_file_util::ExtensionURLToRelativeFilePath(request->url())); 288 extension_file_util::ExtensionURLToRelativeFilePath(request->url()));
289 #if defined(OS_WIN) 289 relative_path = relative_path.NormalizePathSeparators();
290 relative_path = relative_path.NormalizeWindowsPathSeparators();
291 #endif
292 290
293 // TODO(tc): Make a map of FilePath -> resource ids so we don't have to 291 // TODO(tc): Make a map of FilePath -> resource ids so we don't have to
294 // covert to FilePaths all the time. This will be more useful as we add 292 // covert to FilePaths all the time. This will be more useful as we add
295 // more resources. 293 // more resources.
296 for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) { 294 for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) {
297 FilePath bm_resource_path = 295 FilePath bm_resource_path =
298 FilePath().AppendASCII(kComponentExtensionResources[i].name); 296 FilePath().AppendASCII(kComponentExtensionResources[i].name);
299 #if defined(OS_WIN) 297 bm_resource_path = bm_resource_path.NormalizePathSeparators();
300 bm_resource_path = bm_resource_path.NormalizeWindowsPathSeparators();
301 #endif
302 if (relative_path == bm_resource_path) { 298 if (relative_path == bm_resource_path) {
303 return new URLRequestResourceBundleJob(request, relative_path, 299 return new URLRequestResourceBundleJob(request, relative_path,
304 kComponentExtensionResources[i].value, content_security_policy, 300 kComponentExtensionResources[i].value, content_security_policy,
305 send_cors_header); 301 send_cors_header);
306 } 302 }
307 } 303 }
308 } 304 }
309 // TODO(tc): Move all of these files into resources.pak so we don't break 305 // TODO(tc): Move all of these files into resources.pak so we don't break
310 // when updating on Linux. 306 // when updating on Linux.
311 ExtensionResource resource(extension_id, directory_path, 307 ExtensionResource resource(extension_id, directory_path,
(...skipping 11 matching lines...) Expand all
323 content_security_policy, send_cors_header); 319 content_security_policy, send_cors_header);
324 } 320 }
325 321
326 } // namespace 322 } // namespace
327 323
328 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( 324 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
329 bool is_incognito, 325 bool is_incognito,
330 ExtensionInfoMap* extension_info_map) { 326 ExtensionInfoMap* extension_info_map) {
331 return new ExtensionProtocolHandler(is_incognito, extension_info_map); 327 return new ExtensionProtocolHandler(is_incognito, extension_info_map);
332 } 328 }
OLDNEW
« no previous file with comments | « base/file_path_unittest.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698