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

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: Sync 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/extension_action/extension_actions_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 namespace extensions {
15 class TabHelper;
16 }
14 class TabContents; 17 class TabContents;
15 18
16 // Implementation of the browserAction, pageAction, and scriptBadge APIs. 19 // Implementation of the browserAction, pageAction, and scriptBadge APIs.
17 // 20 //
18 // Divergent behaviour between the three is minimal (pageAction and scriptBadge 21 // Divergent behaviour between the three is minimal (pageAction and scriptBadge
19 // have required tabIds while browserAction's are optional, they have different 22 // have required tabIds while browserAction's are optional, they have different
20 // internal browser notification requirements, and not all functions are defined 23 // internal browser notification requirements, and not all functions are defined
21 // for all APIs). 24 // for all APIs).
22 class ExtensionActionFunction : public SyncExtensionFunction { 25 class ExtensionActionFunction : public SyncExtensionFunction {
23 public: 26 public:
24 static bool ParseCSSColorString(const std::string& color_string, 27 static bool ParseCSSColorString(const std::string& color_string,
25 SkColor* result); 28 SkColor* result);
26 29
27 protected: 30 protected:
28 ExtensionActionFunction(); 31 ExtensionActionFunction();
29 virtual ~ExtensionActionFunction(); 32 virtual ~ExtensionActionFunction();
30 virtual bool RunImpl() OVERRIDE; 33 virtual bool RunImpl() OVERRIDE;
31 virtual bool RunExtensionAction() = 0; 34 virtual bool RunExtensionAction() = 0;
32 void NotifyChange(); 35 void NotifyChange();
33 void NotifyBrowserActionChange(); 36 void NotifyBrowserActionChange();
34 void NotifyLocationBarChange(); 37 void NotifyLocationBarChange();
35 bool SetVisible(bool visible); 38 bool SetVisible(bool visible);
36 39
40 // Extension-related information for |tab_id_|.
41 // CHECK-fails if there is no tab.
42 extensions::TabHelper& tab_helper() const;
43
37 // All the extension action APIs take a single argument called details that 44 // All the extension action APIs take a single argument called details that
38 // is a dictionary. 45 // is a dictionary.
39 base::DictionaryValue* details_; 46 base::DictionaryValue* details_;
40 47
41 // The tab id the extension action function should apply to, if any, or 48 // The tab id the extension action function should apply to, if any, or
42 // kDefaultTabId if none was specified. 49 // kDefaultTabId if none was specified.
43 int tab_id_; 50 int tab_id_;
44 51
45 // Tab content for |tab_id_| if one exists. 52 // Tab content for |tab_id_| if one exists.
46 TabContents* contents_; 53 TabContents* contents_;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 136
130 // getBadgeBackgroundColor 137 // getBadgeBackgroundColor
131 class ExtensionActionGetBadgeBackgroundColorFunction 138 class ExtensionActionGetBadgeBackgroundColorFunction
132 : public ExtensionActionFunction { 139 : public ExtensionActionFunction {
133 protected: 140 protected:
134 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} 141 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {}
135 virtual bool RunExtensionAction() OVERRIDE; 142 virtual bool RunExtensionAction() OVERRIDE;
136 }; 143 };
137 144
138 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_ 145 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/extension_action/extension_actions_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698