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

Unified Diff: chrome/common/extensions/api/extension_action/script_badge_handler.h

Issue 11588004: Move ScriptBadge, ActionInfo out of Extension; preparation for BrowserAction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Yoyo's requested changes Created 8 years 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_action/script_badge_handler.h
diff --git a/chrome/common/extensions/api/extension_action/script_badge_handler.h b/chrome/common/extensions/api/extension_action/script_badge_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..dabcd5d9e8f06c3afd1b7632b77907f82f422534
--- /dev/null
+++ b/chrome/common/extensions/api/extension_action/script_badge_handler.h
@@ -0,0 +1,48 @@
+// 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_ACTION_SCRIPT_BADGE_HANDLER_H_
+#define CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_SCRIPT_BADGE_HANDLER_H_
+
+#include <string>
+
+#include "chrome/common/extensions/api/extension_action/action_info.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/manifest_handler.h"
+
+namespace extensions {
+
+struct ScriptBadgeInfo : public Extension::ManifestData {
+ explicit ScriptBadgeInfo(ActionInfo* action_info);
+ virtual ~ScriptBadgeInfo();
+
+ // The extension's script badge. Never NULL.
+ scoped_ptr<ActionInfo> script_badge_info;
+
+ // Returns the script badge for the extension.
+ static const ActionInfo* GetScriptBadge(
+ const Extension* extension);
+};
+
+// Parses the "script_badge" manifest key.
+class ScriptBadgeHandler : public ManifestHandler {
+ public:
+ ScriptBadgeHandler();
+ virtual ~ScriptBadgeHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+
+ virtual bool HasNoKey(Extension* extension, string16* error) OVERRIDE;
+ private:
+ // Sets the fields of ActionInfo to the default values, matching the parent
+ // extension's title and icons. Performed whether or not the script_badge key
+ // is present in the manifest.
+ void SetActionInfoDefaults(Extension* extension, ActionInfo* info);
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_SCRIPT_BADGE_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698