OLD | NEW |
---|---|
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_SCRIPT_BADGE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 class ScriptBadgeController | 49 class ScriptBadgeController |
50 : public base::RefCountedThreadSafe<ScriptBadgeController>, | 50 : public base::RefCountedThreadSafe<ScriptBadgeController>, |
51 public LocationBarController, | 51 public LocationBarController, |
52 public ScriptExecutor, | 52 public ScriptExecutor, |
53 public content::WebContentsObserver, | 53 public content::WebContentsObserver, |
54 public content::NotificationObserver { | 54 public content::NotificationObserver { |
55 public: | 55 public: |
56 explicit ScriptBadgeController(TabContents* tab_contents); | 56 explicit ScriptBadgeController(TabContents* tab_contents); |
57 | 57 |
58 // LocationBarController implementation. | 58 // LocationBarController implementation. |
59 virtual std::vector<ExtensionAction*> GetCurrentActions() OVERRIDE; | 59 virtual std::vector<ExtensionAction*> GetCurrentActions() const OVERRIDE; |
60 virtual base::WeakPtr<IconAnimation> GetIconAnimation( | |
61 const ExtensionAction* action) const OVERRIDE; | |
60 virtual Action OnClicked(const std::string& extension_id, | 62 virtual Action OnClicked(const std::string& extension_id, |
61 int mouse_button) OVERRIDE; | 63 int mouse_button) OVERRIDE; |
62 | 64 |
63 // ScriptExecutor implementation. | 65 // ScriptExecutor implementation. |
64 virtual void ExecuteScript(const std::string& extension_id, | 66 virtual void ExecuteScript(const std::string& extension_id, |
65 ScriptType script_type, | 67 ScriptType script_type, |
66 const std::string& code, | 68 const std::string& code, |
67 FrameScope frame_scope, | 69 FrameScope frame_scope, |
68 UserScript::RunLocation run_at, | 70 UserScript::RunLocation run_at, |
69 WorldType world_type, | 71 WorldType world_type, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 | 120 |
119 // Our parent TabContents. | 121 // Our parent TabContents. |
120 TabContents* tab_contents_; | 122 TabContents* tab_contents_; |
121 | 123 |
122 // The current extension actions in the order they appeared. | 124 // The current extension actions in the order they appeared. |
123 std::vector<ExtensionAction*> current_actions_; | 125 std::vector<ExtensionAction*> current_actions_; |
124 | 126 |
125 // The extensions that have called ExecuteScript on the current frame. | 127 // The extensions that have called ExecuteScript on the current frame. |
126 std::set<std::string> extensions_executing_scripts_; | 128 std::set<std::string> extensions_executing_scripts_; |
127 | 129 |
130 // Active animations for each ExtensionAction (keyed by extension ID). | |
Yoyo Zhou
2012/06/22 00:50:29
Have you considered storing these on the Extension
not at google - send to devlin
2012/06/26 07:30:47
Done. Ended up being simpler to put it on Extensio
| |
131 class IconAnimationWrapper; | |
132 typedef std::map<std::string, linked_ptr<IconAnimationWrapper> > | |
133 IconAnimationMap; | |
134 IconAnimationMap icon_animations_; | |
135 | |
128 // Listen to extension unloaded notifications. | 136 // Listen to extension unloaded notifications. |
129 content::NotificationRegistrar registrar_; | 137 content::NotificationRegistrar registrar_; |
130 | 138 |
131 DISALLOW_COPY_AND_ASSIGN(ScriptBadgeController); | 139 DISALLOW_COPY_AND_ASSIGN(ScriptBadgeController); |
132 }; | 140 }; |
133 | 141 |
134 } // namespace extensions | 142 } // namespace extensions |
135 | 143 |
136 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ | 144 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ |
OLD | NEW |