| 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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 struct WebApplicationInfo; | 24 struct WebApplicationInfo; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 struct LoadCommittedDetails; | 27 struct LoadCommittedDetails; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 class Extension; | 31 class Extension; |
| 32 class LocationBarController; | 32 class LocationBarController; |
| 33 class ScriptBadgeController; | 33 class ScriptBadgeController; |
| 34 class ScriptBubbleController; |
| 34 | 35 |
| 35 // Per-tab extension helper. Also handles non-extension apps. | 36 // Per-tab extension helper. Also handles non-extension apps. |
| 36 class TabHelper : public content::WebContentsObserver, | 37 class TabHelper : public content::WebContentsObserver, |
| 37 public ExtensionFunctionDispatcher::Delegate, | 38 public ExtensionFunctionDispatcher::Delegate, |
| 38 public ImageLoadingTracker::Observer, | 39 public ImageLoadingTracker::Observer, |
| 39 public AppNotifyChannelSetup::Delegate, | 40 public AppNotifyChannelSetup::Delegate, |
| 40 public base::SupportsWeakPtr<TabHelper>, | 41 public base::SupportsWeakPtr<TabHelper>, |
| 41 public content::NotificationObserver, | 42 public content::NotificationObserver, |
| 42 public WebContentsUserData<TabHelper> { | 43 public WebContentsUserData<TabHelper> { |
| 43 public: | 44 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 | 64 |
| 64 virtual void OnContentScriptsExecuting( | 65 virtual void OnContentScriptsExecuting( |
| 65 const content::WebContents* web_contents, | 66 const content::WebContents* web_contents, |
| 66 const ExecutingScriptsMap& executing_scripts_map, | 67 const ExecutingScriptsMap& executing_scripts_map, |
| 67 int32 on_page_id, | 68 int32 on_page_id, |
| 68 const GURL& on_url) = 0; | 69 const GURL& on_url) = 0; |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 virtual ~ContentScriptObserver(); | 72 virtual ~ContentScriptObserver(); |
| 72 | 73 |
| 73 private: | |
| 74 TabHelper* tab_helper_; | 74 TabHelper* tab_helper_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 virtual ~TabHelper(); | 77 virtual ~TabHelper(); |
| 78 | 78 |
| 79 void AddContentScriptObserver(ContentScriptObserver* observer) { | 79 void AddContentScriptObserver(ContentScriptObserver* observer) { |
| 80 content_script_observers_.AddObserver(observer); | 80 content_script_observers_.AddObserver(observer); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void RemoveContentScriptObserver(ContentScriptObserver* observer) { | 83 void RemoveContentScriptObserver(ContentScriptObserver* observer) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 LocationBarController* location_bar_controller() { | 134 LocationBarController* location_bar_controller() { |
| 135 return location_bar_controller_.get(); | 135 return location_bar_controller_.get(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 ActiveTabPermissionGranter* active_tab_permission_granter() { | 138 ActiveTabPermissionGranter* active_tab_permission_granter() { |
| 139 return active_tab_permission_granter_.get(); | 139 return active_tab_permission_granter_.get(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ScriptBubbleController* script_bubble_controller() { |
| 143 return script_bubble_controller_.get(); |
| 144 } |
| 145 |
| 142 // Sets a non-extension app icon associated with WebContents and fires an | 146 // Sets a non-extension app icon associated with WebContents and fires an |
| 143 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 147 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
| 144 void SetAppIcon(const SkBitmap& app_icon); | 148 void SetAppIcon(const SkBitmap& app_icon); |
| 145 | 149 |
| 146 private: | 150 private: |
| 147 explicit TabHelper(content::WebContents* web_contents); | 151 explicit TabHelper(content::WebContents* web_contents); |
| 148 friend class WebContentsUserData<TabHelper>; | 152 friend class WebContentsUserData<TabHelper>; |
| 149 | 153 |
| 150 // content::WebContentsObserver overrides. | 154 // content::WebContentsObserver overrides. |
| 151 virtual void RenderViewCreated( | 155 virtual void RenderViewCreated( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 WebAppAction pending_web_app_action_; | 251 WebAppAction pending_web_app_action_; |
| 248 | 252 |
| 249 content::NotificationRegistrar registrar_; | 253 content::NotificationRegistrar registrar_; |
| 250 | 254 |
| 251 ScriptExecutor script_executor_; | 255 ScriptExecutor script_executor_; |
| 252 | 256 |
| 253 scoped_ptr<LocationBarController> location_bar_controller_; | 257 scoped_ptr<LocationBarController> location_bar_controller_; |
| 254 | 258 |
| 255 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; | 259 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; |
| 256 | 260 |
| 261 scoped_ptr<ScriptBubbleController> script_bubble_controller_; |
| 262 |
| 257 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 263 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
| 258 }; | 264 }; |
| 259 | 265 |
| 260 } // namespace extensions | 266 } // namespace extensions |
| 261 | 267 |
| 262 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 268 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| OLD | NEW |