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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 else | 427 else |
428 return manifest_->type(); | 428 return manifest_->type(); |
429 } | 429 } |
430 | 430 |
431 // static | 431 // static |
432 GURL Extension::GetResourceURL(const GURL& extension_url, | 432 GURL Extension::GetResourceURL(const GURL& extension_url, |
433 const std::string& relative_path) { | 433 const std::string& relative_path) { |
434 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); | 434 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); |
435 DCHECK_EQ("/", extension_url.path()); | 435 DCHECK_EQ("/", extension_url.path()); |
436 | 436 |
437 GURL ret_val = GURL(extension_url.spec() + relative_path); | 437 std::string path = relative_path; |
| 438 |
| 439 // If the relative path starts with "/", it is "absolute" relative to the |
| 440 // extension base directory, but extension_url is already specified to refer |
| 441 // to that base directory, so strip the leading "/" if present. |
| 442 if (relative_path.size() > 0 && relative_path[0] == '/') |
| 443 path = relative_path.substr(1); |
| 444 |
| 445 GURL ret_val = GURL(extension_url.spec() + path); |
438 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); | 446 DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); |
439 | 447 |
440 return ret_val; | 448 return ret_val; |
441 } | 449 } |
442 | 450 |
443 bool Extension::is_platform_app() const { | 451 bool Extension::is_platform_app() const { |
444 return manifest_->is_platform_app(); | 452 return manifest_->is_platform_app(); |
445 } | 453 } |
446 | 454 |
447 bool Extension::is_hosted_app() const { | 455 bool Extension::is_hosted_app() const { |
(...skipping 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3544 already_disabled(false), | 3552 already_disabled(false), |
3545 extension(extension) {} | 3553 extension(extension) {} |
3546 | 3554 |
3547 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3555 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3548 const Extension* extension, | 3556 const Extension* extension, |
3549 const ExtensionPermissionSet* permissions, | 3557 const ExtensionPermissionSet* permissions, |
3550 Reason reason) | 3558 Reason reason) |
3551 : reason(reason), | 3559 : reason(reason), |
3552 extension(extension), | 3560 extension(extension), |
3553 permissions(permissions) {} | 3561 permissions(permissions) {} |
OLD | NEW |