| 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 ExtensionTabHelperDelegate; | 19 class ExtensionTabHelperDelegate; |
| 20 class TabContentsWrapper; | 20 class TabContentsWrapper; |
| 21 struct WebApplicationInfo; | 21 struct WebApplicationInfo; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 struct LoadCommittedDetails; | 24 struct LoadCommittedDetails; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 class ActionBoxController; | |
| 29 class Extension; | 28 class Extension; |
| 29 class LocationBarController; |
| 30 class ScriptBadgeController; | 30 class ScriptBadgeController; |
| 31 class ScriptExecutor; | 31 class ScriptExecutor; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Per-tab extension helper. Also handles non-extension apps. | 34 // Per-tab extension helper. Also handles non-extension apps. |
| 35 class ExtensionTabHelper | 35 class ExtensionTabHelper |
| 36 : public content::WebContentsObserver, | 36 : public content::WebContentsObserver, |
| 37 public ExtensionFunctionDispatcher::Delegate, | 37 public ExtensionFunctionDispatcher::Delegate, |
| 38 public ImageLoadingTracker::Observer, | 38 public ImageLoadingTracker::Observer, |
| 39 public WebstoreInlineInstaller::Delegate, | 39 public WebstoreInlineInstaller::Delegate, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 TabContentsWrapper* tab_contents_wrapper() { | 92 TabContentsWrapper* tab_contents_wrapper() { |
| 93 return wrapper_; | 93 return wrapper_; |
| 94 } | 94 } |
| 95 | 95 |
| 96 content::WebContents* web_contents() const { | 96 content::WebContents* web_contents() const { |
| 97 return content::WebContentsObserver::web_contents(); | 97 return content::WebContentsObserver::web_contents(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 extensions::ScriptExecutor* script_executor(); | 100 extensions::ScriptExecutor* script_executor(); |
| 101 | 101 |
| 102 extensions::ActionBoxController* action_box_controller(); | 102 extensions::LocationBarController* location_bar_controller(); |
| 103 | 103 |
| 104 // Sets a non-extension app icon associated with WebContents and fires an | 104 // Sets a non-extension app icon associated with WebContents and fires an |
| 105 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 105 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
| 106 void SetAppIcon(const SkBitmap& app_icon); | 106 void SetAppIcon(const SkBitmap& app_icon); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // content::WebContentsObserver overrides. | 109 // content::WebContentsObserver overrides. |
| 110 virtual void DidNavigateMainFrame( | 110 virtual void DidNavigateMainFrame( |
| 111 const content::LoadCommittedDetails& details, | 111 const content::LoadCommittedDetails& details, |
| 112 const content::FrameNavigateParams& params) OVERRIDE; | 112 const content::FrameNavigateParams& params) OVERRIDE; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 ExtensionFunctionDispatcher extension_function_dispatcher_; | 181 ExtensionFunctionDispatcher extension_function_dispatcher_; |
| 182 | 182 |
| 183 // Used for loading extension_app_icon_. | 183 // Used for loading extension_app_icon_. |
| 184 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; | 184 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; |
| 185 | 185 |
| 186 // Cached web app info data. | 186 // Cached web app info data. |
| 187 WebApplicationInfo web_app_info_; | 187 WebApplicationInfo web_app_info_; |
| 188 | 188 |
| 189 TabContentsWrapper* wrapper_; | 189 TabContentsWrapper* wrapper_; |
| 190 | 190 |
| 191 // Either script_executor/action_box_controller will have values, or | 191 // Either script_executor/location_bar_controller will have values, or |
| 192 // script_badge_controller will have a value, depending on whether the action | 192 // script_badge_controller will have a value, depending on whether the action |
| 193 // box is turned on. | 193 // box is turned on. |
| 194 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 194 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
| 195 scoped_ptr<extensions::ActionBoxController> action_box_controller_; | 195 scoped_ptr<extensions::LocationBarController> location_bar_controller_; |
| 196 scoped_ptr<extensions::ScriptBadgeController> script_badge_controller_; | 196 scoped_ptr<extensions::ScriptBadgeController> script_badge_controller_; |
| 197 | 197 |
| 198 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); | 198 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 201 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
| OLD | NEW |