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

Unified Diff: chrome/common/extensions/api/extension_urls/extension_urls_handler.h

Issue 11742005: Move [Homepage,Options,Update,DevTools]URL out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 12 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/api/extension_urls/extension_urls_handler.h
diff --git a/chrome/common/extensions/api/extension_urls/extension_urls_handler.h b/chrome/common/extensions/api/extension_urls/extension_urls_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a79f3bca5d887672272edcb93b9350a66a2a885
--- /dev/null
+++ b/chrome/common/extensions/api/extension_urls/extension_urls_handler.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_EXTENSIONS_API_EXTENSION_URLS_EXTENSION_URLS_HANDLER_H_
+#define CHROME_COMMON_EXTENSIONS_API_EXTENSION_URLS_EXTENSION_URLS_HANDLER_H_
+
+#include <string>
+
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/manifest_handler.h"
+#include "googleurl/src/gurl.h"
+
+namespace extensions {
+
+struct ExtensionURL : public Extension::ManifestData {
+ explicit ExtensionURL(const GURL& url);
+ virtual ~ExtensionURL();
+
+ // The URL to one of the following:
+ // - The extension's devtools page (optional).
+ // - The extension's homepage, which is useful if it is not hosted by Google
+ // and therefore doesn't have a Gallery URL.
+ // - The extension's update url, for fetching an update manifest.
+ // - The extension's options page, for setting options/preferences (optional).
+ GURL url;
+
+ // Return the appropriate url for a given |extension|.
+ static const GURL& GetDevToolsURL(const Extension* extension);
+ static GURL GetHomepageURL(const Extension* extension);
+ static const GURL& GetOptionsURL(const Extension* extension);
+ static const GURL& GetUpdateURL(const Extension* extension);
+};
+
+// Parses the "devtools_page" manifest key.
+class DevToolsPageHandler : public ManifestHandler {
+ public:
+ DevToolsPageHandler();
+ virtual ~DevToolsPageHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+};
+
+// Parses the "homepage_url" manifest key.
+class HomepageURLHandler : public ManifestHandler {
+ public:
+ HomepageURLHandler();
+ virtual ~HomepageURLHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+};
+
+// Parses the "options_page" manifest key.
+class OptionsPageHandler : public ManifestHandler {
+ public:
+ OptionsPageHandler();
+ virtual ~OptionsPageHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+};
+
+// Parses the "update_url" manifest key.
+class UpdateURLHandler : public ManifestHandler {
+ public:
+ UpdateURLHandler();
+ virtual ~UpdateURLHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_URLS_EXTENSION_URLS_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698