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

Unified Diff: chrome/common/extensions/manifest_url_handler.cc

Issue 518653002: Add the "options_ui" extension manifest field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build issue? Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_url_handler.cc
diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc
index 1aa6481ec25dc7cfeb0e0e58d4474d922953b6fd..4833bddd0169be6997d30744ba619ea9b990b3c7 100644
--- a/chrome/common/extensions/manifest_url_handler.cc
+++ b/chrome/common/extensions/manifest_url_handler.cc
@@ -89,11 +89,6 @@ bool ManifestURL::UpdatesFromGallery(const base::DictionaryValue* manifest) {
}
// static
-const GURL& ManifestURL::GetOptionsPage(const Extension* extension) {
- return GetManifestURL(extension, keys::kOptionsPage);
-}
-
-// static
const GURL& ManifestURL::GetAboutPage(const Extension* extension) {
return GetManifestURL(extension, keys::kAboutPage);
}
@@ -209,74 +204,6 @@ const std::vector<std::string> UpdateURLHandler::Keys() const {
return SingleKey(keys::kUpdateURL);
}
-OptionsPageHandler::OptionsPageHandler() {
-}
-
-OptionsPageHandler::~OptionsPageHandler() {
-}
-
-bool OptionsPageHandler::Parse(Extension* extension, base::string16* error) {
- scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
- std::string options_str;
- if (!extension->manifest()->GetString(keys::kOptionsPage, &options_str)) {
- *error = base::ASCIIToUTF16(errors::kInvalidOptionsPage);
- return false;
- }
-
- if (extension->is_hosted_app()) {
- // hosted apps require an absolute URL.
- GURL options_url(options_str);
- if (!options_url.is_valid() ||
- !options_url.SchemeIsHTTPOrHTTPS()) {
- *error = base::ASCIIToUTF16(errors::kInvalidOptionsPageInHostedApp);
- return false;
- }
- manifest_url->url_ = options_url;
- } else {
- GURL absolute(options_str);
- if (absolute.is_valid()) {
- *error =
- base::ASCIIToUTF16(errors::kInvalidOptionsPageExpectUrlInPackage);
- return false;
- }
- manifest_url->url_ = extension->GetResourceURL(options_str);
- if (!manifest_url->url_.is_valid()) {
- *error = base::ASCIIToUTF16(errors::kInvalidOptionsPage);
- return false;
- }
- }
-
- extension->SetManifestData(keys::kOptionsPage, manifest_url.release());
- return true;
-}
-
-bool OptionsPageHandler::Validate(const Extension* extension,
- std::string* error,
- std::vector<InstallWarning>* warnings) const {
- // Validate path to the options page. Don't check the URL for hosted apps,
- // because they are expected to refer to an external URL.
- if (!extensions::ManifestURL::GetOptionsPage(extension).is_empty() &&
- !extension->is_hosted_app()) {
- const base::FilePath options_path =
- extensions::file_util::ExtensionURLToRelativeFilePath(
- extensions::ManifestURL::GetOptionsPage(extension));
- const base::FilePath path =
- extension->GetResource(options_path).GetFilePath();
- if (path.empty() || !base::PathExists(path)) {
- *error =
- l10n_util::GetStringFUTF8(
- IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED,
- options_path.LossyDisplayName());
- return false;
- }
- }
- return true;
-}
-
-const std::vector<std::string> OptionsPageHandler::Keys() const {
- return SingleKey(keys::kOptionsPage);
-}
-
AboutPageHandler::AboutPageHandler() {
}

Powered by Google App Engine
This is Rietveld 408576698