| OLD | NEW |
| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 return new GeneratedBackgroundPageJob( | 289 return new GeneratedBackgroundPageJob( |
| 290 request, extension, content_security_policy); | 290 request, extension, content_security_policy); |
| 291 } | 291 } |
| 292 | 292 |
| 293 FilePath resources_path; | 293 FilePath resources_path; |
| 294 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) && | 294 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) && |
| 295 (directory_path.DirName() == resources_path || | 295 (directory_path.DirName() == resources_path || |
| 296 // Support adding chromeos specific component extension to | 296 // Support adding chromeos specific component extension to |
| 297 // resources_path/chromeos directory. This corresponds to | 297 // resources_path/chromeos directory. This corresponds to |
| 298 // src/chrome/browser/resources/chromeos in source tree. | 298 // src/chrome/browser/resources/chromeos in source tree. |
| 299 directory_path.DirName() == resources_path.Append( | 299 directory_path.DirName() == resources_path.Append("chromeos"))) { |
| 300 FILE_PATH_LITERAL("chromeos")))) { | |
| 301 FilePath relative_path; | 300 FilePath relative_path; |
| 302 // Since component extension resources are included in | 301 // Since component extension resources are included in |
| 303 // component_extension_resources.pak file, calculate extension relative | 302 // component_extension_resources.pak file, calculate extension relative |
| 304 // path against resources_path. | 303 // path against resources_path. |
| 305 resources_path.AppendRelativePath(directory_path, &relative_path); | 304 resources_path.AppendRelativePath(directory_path, &relative_path); |
| 306 relative_path = relative_path.Append( | 305 relative_path = relative_path.Append( |
| 307 extension_file_util::ExtensionURLToRelativeFilePath(request->url())); | 306 extension_file_util::ExtensionURLToRelativeFilePath(request->url())); |
| 308 relative_path = relative_path.NormalizePathSeparators(); | 307 relative_path = relative_path.NormalizePathSeparators(); |
| 309 | 308 |
| 310 // TODO(tc): Make a map of FilePath -> resource ids so we don't have to | 309 // TODO(tc): Make a map of FilePath -> resource ids so we don't have to |
| (...skipping 27 matching lines...) Expand all Loading... |
| 338 content_security_policy, send_cors_header); | 337 content_security_policy, send_cors_header); |
| 339 } | 338 } |
| 340 | 339 |
| 341 } // namespace | 340 } // namespace |
| 342 | 341 |
| 343 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 342 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
| 344 bool is_incognito, | 343 bool is_incognito, |
| 345 ExtensionInfoMap* extension_info_map) { | 344 ExtensionInfoMap* extension_info_map) { |
| 346 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 345 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
| 347 } | 346 } |
| OLD | NEW |