| 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/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/extensions/active_tab_permission_manager.h" |
| 12 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 13 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
| 13 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 14 #include "chrome/browser/extensions/image_loading_tracker.h" | 15 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 15 #include "chrome/browser/extensions/webstore_inline_installer.h" | 16 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 16 #include "chrome/common/web_apps.h" | 17 #include "chrome/common/web_apps.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 | 20 |
| 20 class ExtensionTabHelperDelegate; | 21 class ExtensionTabHelperDelegate; |
| 21 class TabContents; | 22 class TabContents; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 void set_delegate(ExtensionTabHelperDelegate* d) { delegate_ = d; } | 52 void set_delegate(ExtensionTabHelperDelegate* d) { delegate_ = d; } |
| 52 | 53 |
| 53 // Call this after updating a page action to notify clients about the changes. | 54 // Call this after updating a page action to notify clients about the changes. |
| 54 void PageActionStateChanged(); | 55 void PageActionStateChanged(); |
| 55 | 56 |
| 56 // Requests application info for the specified page. This is an asynchronous | 57 // Requests application info for the specified page. This is an asynchronous |
| 57 // request. The delegate is notified by way of OnDidGetApplicationInfo when | 58 // request. The delegate is notified by way of OnDidGetApplicationInfo when |
| 58 // the data is available. | 59 // the data is available. |
| 59 void GetApplicationInfo(int32 page_id); | 60 void GetApplicationInfo(int32 page_id); |
| 60 | 61 |
| 62 // Gets the ID of the tab. |
| 63 int tab_id() const; |
| 64 |
| 65 // Gets the window ID of the tab. |
| 66 int window_id() const; |
| 67 |
| 61 // App extensions ------------------------------------------------------------ | 68 // App extensions ------------------------------------------------------------ |
| 62 | 69 |
| 63 // Sets the extension denoting this as an app. If |extension| is non-null this | 70 // Sets the extension denoting this as an app. If |extension| is non-null this |
| 64 // tab becomes an app-tab. WebContents does not listen for unload events for | 71 // tab becomes an app-tab. WebContents does not listen for unload events for |
| 65 // the extension. It's up to consumers of WebContents to do that. | 72 // the extension. It's up to consumers of WebContents to do that. |
| 66 // | 73 // |
| 67 // NOTE: this should only be manipulated before the tab is added to a browser. | 74 // NOTE: this should only be manipulated before the tab is added to a browser. |
| 68 // TODO(sky): resolve if this is the right way to identify an app tab. If it | 75 // TODO(sky): resolve if this is the right way to identify an app tab. If it |
| 69 // is, than this should be passed in the constructor. | 76 // is, than this should be passed in the constructor. |
| 70 void SetExtensionApp(const extensions::Extension* extension); | 77 void SetExtensionApp(const extensions::Extension* extension); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 95 } | 102 } |
| 96 | 103 |
| 97 content::WebContents* web_contents() const { | 104 content::WebContents* web_contents() const { |
| 98 return content::WebContentsObserver::web_contents(); | 105 return content::WebContentsObserver::web_contents(); |
| 99 } | 106 } |
| 100 | 107 |
| 101 extensions::ScriptExecutor* script_executor(); | 108 extensions::ScriptExecutor* script_executor(); |
| 102 | 109 |
| 103 extensions::LocationBarController* location_bar_controller(); | 110 extensions::LocationBarController* location_bar_controller(); |
| 104 | 111 |
| 112 extensions::ActiveTabPermissionManager* active_tab_permission_manager() { |
| 113 return &active_tab_permission_manager_; |
| 114 } |
| 115 |
| 105 // Sets a non-extension app icon associated with WebContents and fires an | 116 // Sets a non-extension app icon associated with WebContents and fires an |
| 106 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 117 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
| 107 void SetAppIcon(const SkBitmap& app_icon); | 118 void SetAppIcon(const SkBitmap& app_icon); |
| 108 | 119 |
| 109 private: | 120 private: |
| 110 // content::WebContentsObserver overrides. | 121 // content::WebContentsObserver overrides. |
| 122 virtual void RenderViewCreated( |
| 123 content::RenderViewHost* render_view_host) OVERRIDE; |
| 111 virtual void DidNavigateMainFrame( | 124 virtual void DidNavigateMainFrame( |
| 112 const content::LoadCommittedDetails& details, | 125 const content::LoadCommittedDetails& details, |
| 113 const content::FrameNavigateParams& params) OVERRIDE; | 126 const content::FrameNavigateParams& params) OVERRIDE; |
| 114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 127 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 115 | 128 |
| 116 // ExtensionFunctionDispatcher::Delegate overrides. | 129 // ExtensionFunctionDispatcher::Delegate overrides. |
| 117 virtual ExtensionWindowController* GetExtensionWindowController() | 130 virtual ExtensionWindowController* GetExtensionWindowController() |
| 118 const OVERRIDE; | 131 const OVERRIDE; |
| 119 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 132 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 120 | 133 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 202 |
| 190 TabContents* tab_contents_; | 203 TabContents* tab_contents_; |
| 191 | 204 |
| 192 // Either script_executor/location_bar_controller will have values, or | 205 // Either script_executor/location_bar_controller will have values, or |
| 193 // script_badge_controller will have a value, depending on whether the action | 206 // script_badge_controller will have a value, depending on whether the action |
| 194 // box is turned on. | 207 // box is turned on. |
| 195 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 208 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
| 196 scoped_ptr<extensions::LocationBarController> location_bar_controller_; | 209 scoped_ptr<extensions::LocationBarController> location_bar_controller_; |
| 197 scoped_refptr<extensions::ScriptBadgeController> script_badge_controller_; | 210 scoped_refptr<extensions::ScriptBadgeController> script_badge_controller_; |
| 198 | 211 |
| 212 extensions::ActiveTabPermissionManager active_tab_permission_manager_; |
| 213 |
| 199 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); | 214 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); |
| 200 }; | 215 }; |
| 201 | 216 |
| 202 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 217 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
| OLD | NEW |