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_EXTENSION_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 11 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
12 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 12 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
13 #include "chrome/browser/extensions/image_loading_tracker.h" | 13 #include "chrome/browser/extensions/image_loading_tracker.h" |
14 #include "chrome/browser/extensions/webstore_inline_installer.h" | 14 #include "chrome/browser/extensions/webstore_inline_installer.h" |
15 #include "chrome/common/web_apps.h" | 15 #include "chrome/common/web_apps.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
18 | 18 |
19 class Extension; | 19 class Extension; |
20 class ExtensionTabHelperDelegate; | 20 class ExtensionTabHelperDelegate; |
21 class TabContentsWrapper; | 21 class TabContentsWrapper; |
22 struct WebApplicationInfo; | 22 struct WebApplicationInfo; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 struct LoadCommittedDetails; | 25 struct LoadCommittedDetails; |
26 } | 26 } |
27 | 27 |
28 namespace extensions { | 28 namespace extensions { |
29 class ActionBoxController; | 29 class ActionBoxController; |
| 30 class ScriptBadgeController; |
30 class ScriptExecutor; | 31 class ScriptExecutor; |
31 } | 32 } |
32 | 33 |
33 // Per-tab extension helper. Also handles non-extension apps. | 34 // Per-tab extension helper. Also handles non-extension apps. |
34 class ExtensionTabHelper | 35 class ExtensionTabHelper |
35 : public content::WebContentsObserver, | 36 : public content::WebContentsObserver, |
36 public ExtensionFunctionDispatcher::Delegate, | 37 public ExtensionFunctionDispatcher::Delegate, |
37 public ImageLoadingTracker::Observer, | 38 public ImageLoadingTracker::Observer, |
38 public WebstoreInlineInstaller::Delegate, | 39 public WebstoreInlineInstaller::Delegate, |
39 public AppNotifyChannelSetup::Delegate, | 40 public AppNotifyChannelSetup::Delegate, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 SkBitmap* GetExtensionAppIcon(); | 103 SkBitmap* GetExtensionAppIcon(); |
103 | 104 |
104 TabContentsWrapper* tab_contents_wrapper() { | 105 TabContentsWrapper* tab_contents_wrapper() { |
105 return wrapper_; | 106 return wrapper_; |
106 } | 107 } |
107 | 108 |
108 content::WebContents* web_contents() const { | 109 content::WebContents* web_contents() const { |
109 return content::WebContentsObserver::web_contents(); | 110 return content::WebContentsObserver::web_contents(); |
110 } | 111 } |
111 | 112 |
112 extensions::ScriptExecutor* script_executor() { | 113 extensions::ScriptExecutor* script_executor(); |
113 return script_executor_.get(); | |
114 } | |
115 | 114 |
116 extensions::ActionBoxController* action_box_controller() { | 115 extensions::ActionBoxController* action_box_controller(); |
117 return action_box_controller_.get(); | |
118 } | |
119 | 116 |
120 // Sets a non-extension app icon associated with WebContents and fires an | 117 // Sets a non-extension app icon associated with WebContents and fires an |
121 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 118 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
122 void SetAppIcon(const SkBitmap& app_icon); | 119 void SetAppIcon(const SkBitmap& app_icon); |
123 | 120 |
124 private: | 121 private: |
125 // content::WebContentsObserver overrides. | 122 // content::WebContentsObserver overrides. |
126 virtual void DidNavigateMainFrame( | 123 virtual void DidNavigateMainFrame( |
127 const content::LoadCommittedDetails& details, | 124 const content::LoadCommittedDetails& details, |
128 const content::FrameNavigateParams& params) OVERRIDE; | 125 const content::FrameNavigateParams& params) OVERRIDE; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 ExtensionFunctionDispatcher extension_function_dispatcher_; | 193 ExtensionFunctionDispatcher extension_function_dispatcher_; |
197 | 194 |
198 // Used for loading extension_app_icon_. | 195 // Used for loading extension_app_icon_. |
199 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; | 196 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; |
200 | 197 |
201 // Cached web app info data. | 198 // Cached web app info data. |
202 WebApplicationInfo web_app_info_; | 199 WebApplicationInfo web_app_info_; |
203 | 200 |
204 TabContentsWrapper* wrapper_; | 201 TabContentsWrapper* wrapper_; |
205 | 202 |
| 203 // Either script_executor/action_box_controller will have values, or |
| 204 // script_badge_controller will have a value, depending on whether the action |
| 205 // box is turned on. |
206 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 206 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
207 | |
208 scoped_ptr<extensions::ActionBoxController> action_box_controller_; | 207 scoped_ptr<extensions::ActionBoxController> action_box_controller_; |
| 208 scoped_ptr<extensions::ScriptBadgeController> script_badge_controller_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); | 210 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); |
211 }; | 211 }; |
212 | 212 |
213 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 213 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
OLD | NEW |