Chromium Code Reviews| Index: chrome/common/extensions/extension.cc |
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc |
| index cbe9a2d3ac271ec86210ee42fd28ea335778f616..a7c674116af4251e6ea1e6ab0851b35034b821ac 100644 |
| --- a/chrome/common/extensions/extension.cc |
| +++ b/chrome/common/extensions/extension.cc |
| @@ -26,6 +26,7 @@ |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/chrome_version_info.h" |
| +#include "chrome/common/extensions/api/url_parser/url_info.h" |
| #include "chrome/common/extensions/csp_validator.h" |
| #include "chrome/common/extensions/extension_manifest_constants.h" |
| #include "chrome/common/extensions/extension_resource.h" |
| @@ -484,7 +485,7 @@ void Extension::GetBasicInfo(bool enabled, |
| info->SetString(info_keys::kOptionsUrlKey, |
| options_url().possibly_invalid_spec()); |
| info->SetString(info_keys::kHomepageUrlKey, |
| - GetHomepageURL().possibly_invalid_spec()); |
| + URLInfo::url(this, URLInfo::HOMEPAGE_URL).possibly_invalid_spec()); |
| info->SetString(info_keys::kDetailsUrlKey, |
| details_url().possibly_invalid_spec()); |
| info->SetBoolean(info_keys::kPackagedAppKey, is_platform_app()); |
| @@ -949,14 +950,6 @@ bool Extension::ShowConfigureContextMenus() const { |
| return location() != Extension::COMPONENT; |
| } |
| -GURL Extension::GetHomepageURL() const { |
| - if (homepage_url_.is_valid()) |
| - return homepage_url_; |
| - |
| - return UpdatesFromGallery() ? |
| - GURL(extension_urls::GetWebstoreItemDetailURLPrefix() + id()) : GURL(); |
| -} |
| - |
| std::set<FilePath> Extension::GetBrowserImages() const { |
| std::set<FilePath> image_paths; |
| // TODO(viettrungluu): These |FilePath::FromWStringHack(UTF8ToWide())| |
| @@ -1587,6 +1580,8 @@ bool Extension::InitFromValue(int flags, string16* error) { |
| return false; |
| } |
| + finished_parsing_manifest_ = true; |
|
Yoyo Zhou
2012/12/27 17:16:17
Why is this being moved? By the way, Devlin is cha
Joe Thomas
2012/12/30 04:26:00
PermissionSet constructor below queries for "devto
Yoyo Zhou
2013/01/03 01:45:54
Once that lands, you should not need to change thi
|
| + |
| runtime_data_.SetActivePermissions(new PermissionSet( |
| this, api_permissions, host_permissions)); |
| required_permission_set_ = new PermissionSet( |
| @@ -1594,8 +1589,6 @@ bool Extension::InitFromValue(int flags, string16* error) { |
| optional_permission_set_ = new PermissionSet( |
| optional_api_permissions, optional_host_permissions, URLPatternSet()); |
| - finished_parsing_manifest_ = true; |
| - |
| return true; |
| } |
| @@ -1934,7 +1927,6 @@ bool Extension::LoadSharedFeatures( |
| const APIPermissionSet& api_permissions, |
| string16* error) { |
| if (!LoadDescription(error) || |
| - !LoadHomepageURL(error) || |
| !LoadUpdateURL(error) || |
| !LoadIcons(error) || |
| !LoadCommands(error) || |
| @@ -1993,26 +1985,6 @@ bool Extension::LoadManifestVersion(string16* error) { |
| return true; |
| } |
| -bool Extension::LoadHomepageURL(string16* error) { |
| - if (!manifest_->HasKey(keys::kHomepageURL)) |
| - return true; |
| - std::string tmp_homepage_url; |
| - if (!manifest_->GetString(keys::kHomepageURL, &tmp_homepage_url)) { |
| - *error = ErrorUtils::FormatErrorMessageUTF16( |
| - errors::kInvalidHomepageURL, ""); |
| - return false; |
| - } |
| - homepage_url_ = GURL(tmp_homepage_url); |
| - if (!homepage_url_.is_valid() || |
| - (!homepage_url_.SchemeIs("http") && |
| - !homepage_url_.SchemeIs("https"))) { |
| - *error = ErrorUtils::FormatErrorMessageUTF16( |
| - errors::kInvalidHomepageURL, tmp_homepage_url); |
| - return false; |
| - } |
| - return true; |
| -} |
| - |
| bool Extension::LoadUpdateURL(string16* error) { |
| if (!manifest_->HasKey(keys::kUpdateURL)) |
| return true; |
| @@ -2791,7 +2763,6 @@ bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions, |
| &converted_from_user_script_); |
| if (!LoadManifestHandlerFeatures(error) || |
| - !LoadDevToolsPage(error) || |
| !LoadInputComponents(*api_permissions, error) || |
| !LoadContentScripts(error) || |
| !LoadPageAction(error) || |
| @@ -2821,18 +2792,6 @@ bool Extension::LoadManifestHandlerFeatures(string16* error) { |
| return true; |
| } |
| -bool Extension::LoadDevToolsPage(string16* error) { |
| - if (!manifest_->HasKey(keys::kDevToolsPage)) |
| - return true; |
| - std::string devtools_str; |
| - if (!manifest_->GetString(keys::kDevToolsPage, &devtools_str)) { |
| - *error = ASCIIToUTF16(errors::kInvalidDevToolsPage); |
| - return false; |
| - } |
| - devtools_url_ = GetResourceURL(devtools_str); |
| - return true; |
| -} |
| - |
| bool Extension::LoadInputComponents(const APIPermissionSet& api_permissions, |
| string16* error) { |
| if (!manifest_->HasKey(keys::kInputComponents)) |