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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_actions_api.h

Issue 10695070: Implement scriptBadge.requestToAct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more of Aaron's comments. Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
7 7
8 #include "chrome/browser/extensions/extension_function.h" 8 #include "chrome/browser/extensions/extension_function.h"
9 #include "chrome/common/extensions/extension_action.h" 9 #include "chrome/common/extensions/extension_action.h"
10 10
11 namespace base { 11 namespace base {
12 class DictionaryValue; 12 class DictionaryValue;
13 } 13 }
14 class ExtensionTabHelper;
14 class TabContents; 15 class TabContents;
15 16
16 // Implementation of the browserAction, pageAction, and scriptBadge APIs. 17 // Implementation of the browserAction, pageAction, and scriptBadge APIs.
17 // 18 //
18 // Divergent behaviour between the three is minimal (pageAction and scriptBadge 19 // Divergent behaviour between the three is minimal (pageAction and scriptBadge
19 // have required tabIds while browserAction's are optional, they have different 20 // have required tabIds while browserAction's are optional, they have different
20 // internal browser notification requirements, and not all functions are defined 21 // internal browser notification requirements, and not all functions are defined
21 // for all APIs). 22 // for all APIs).
22 class ExtensionActionFunction : public SyncExtensionFunction { 23 class ExtensionActionFunction : public SyncExtensionFunction {
23 public: 24 public:
24 static bool ParseCSSColorString(const std::string& color_string, 25 static bool ParseCSSColorString(const std::string& color_string,
25 SkColor* result); 26 SkColor* result);
26 27
27 protected: 28 protected:
28 ExtensionActionFunction(); 29 ExtensionActionFunction();
29 virtual ~ExtensionActionFunction(); 30 virtual ~ExtensionActionFunction();
30 virtual bool RunImpl() OVERRIDE; 31 virtual bool RunImpl() OVERRIDE;
31 virtual bool RunExtensionAction() = 0; 32 virtual bool RunExtensionAction() = 0;
32 void NotifyChange(); 33 void NotifyChange();
33 void NotifyBrowserActionChange(); 34 void NotifyBrowserActionChange();
34 void NotifyLocationBarChange(); 35 void NotifyLocationBarChange();
35 bool SetVisible(bool visible); 36 bool SetVisible(bool visible);
36 37
38 // Extension-related information for |tab_id_|.
39 // CHECK-fails if there is no tab.
40 ExtensionTabHelper& tab_helper() const;
41
37 // All the extension action APIs take a single argument called details that 42 // All the extension action APIs take a single argument called details that
38 // is a dictionary. 43 // is a dictionary.
39 base::DictionaryValue* details_; 44 base::DictionaryValue* details_;
40 45
41 // The tab id the extension action function should apply to, if any, or 46 // The tab id the extension action function should apply to, if any, or
42 // kDefaultTabId if none was specified. 47 // kDefaultTabId if none was specified.
43 int tab_id_; 48 int tab_id_;
44 49
45 // Tab content for |tab_id_| if one exists. 50 // Tab content for |tab_id_| if one exists.
46 TabContents* contents_; 51 TabContents* contents_;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 134
130 // getBadgeBackgroundColor 135 // getBadgeBackgroundColor
131 class ExtensionActionGetBadgeBackgroundColorFunction 136 class ExtensionActionGetBadgeBackgroundColorFunction
132 : public ExtensionActionFunction { 137 : public ExtensionActionFunction {
133 protected: 138 protected:
134 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} 139 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {}
135 virtual bool RunExtensionAction() OVERRIDE; 140 virtual bool RunExtensionAction() OVERRIDE;
136 }; 141 };
137 142
138 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_ 143 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698