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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 else | 428 else |
429 return manifest_->type(); | 429 return manifest_->type(); |
430 } | 430 } |
431 | 431 |
432 // static | 432 // static |
433 GURL Extension::GetResourceURL(const GURL& extension_url, | 433 GURL Extension::GetResourceURL(const GURL& extension_url, |
434 const std::string& relative_path) { | 434 const std::string& relative_path) { |
435 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); | 435 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); |
436 DCHECK_EQ("/", extension_url.path()); | 436 DCHECK_EQ("/", extension_url.path()); |
437 | 437 |
438 GURL ret_val = GURL(extension_url.spec() + relative_path); | 438 std::string path = relative_path; |
| 439 |
| 440 // If the relative path starts with "/", it is "absolute" relative to the |
| 441 // extension base directory, but extension_url is already specified to refer |
| 442 // to that base directory, so strip the leading "/" if present. |
| 443 if (relative_path.size() > 0 && relative_path[0] == '/') |
| 444 path = relative_path.substr(1); |
| 445 |
| 446 GURL ret_val = GURL(extension_url.spec() + path); |
439 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); | 447 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); |
440 | 448 |
441 return ret_val; | 449 return ret_val; |
442 } | 450 } |
443 | 451 |
444 bool Extension::is_platform_app() const { | 452 bool Extension::is_platform_app() const { |
445 return manifest_->is_platform_app(); | 453 return manifest_->is_platform_app(); |
446 } | 454 } |
447 | 455 |
448 bool Extension::is_hosted_app() const { | 456 bool Extension::is_hosted_app() const { |
(...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3555 already_disabled(false), | 3563 already_disabled(false), |
3556 extension(extension) {} | 3564 extension(extension) {} |
3557 | 3565 |
3558 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3566 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3559 const Extension* extension, | 3567 const Extension* extension, |
3560 const ExtensionPermissionSet* permissions, | 3568 const ExtensionPermissionSet* permissions, |
3561 Reason reason) | 3569 Reason reason) |
3562 : reason(reason), | 3570 : reason(reason), |
3563 extension(extension), | 3571 extension(extension), |
3564 permissions(permissions) {} | 3572 permissions(permissions) {} |
OLD | NEW |