| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class LocationBarController; | 44 class LocationBarController; |
| 45 class WebstoreInlineInstallerFactory; | 45 class WebstoreInlineInstallerFactory; |
| 46 | 46 |
| 47 // Per-tab extension helper. Also handles non-extension apps. | 47 // Per-tab extension helper. Also handles non-extension apps. |
| 48 class TabHelper : public content::WebContentsObserver, | 48 class TabHelper : public content::WebContentsObserver, |
| 49 public extensions::ExtensionFunctionDispatcher::Delegate, | 49 public extensions::ExtensionFunctionDispatcher::Delegate, |
| 50 public base::SupportsWeakPtr<TabHelper>, | 50 public base::SupportsWeakPtr<TabHelper>, |
| 51 public content::NotificationObserver, | 51 public content::NotificationObserver, |
| 52 public content::WebContentsUserData<TabHelper> { | 52 public content::WebContentsUserData<TabHelper> { |
| 53 public: | 53 public: |
| 54 virtual ~TabHelper(); | 54 ~TabHelper() override; |
| 55 | 55 |
| 56 void CreateApplicationShortcuts(); | 56 void CreateApplicationShortcuts(); |
| 57 void CreateHostedAppFromWebContents(); | 57 void CreateHostedAppFromWebContents(); |
| 58 bool CanCreateApplicationShortcuts() const; | 58 bool CanCreateApplicationShortcuts() const; |
| 59 bool CanCreateBookmarkApp() const; | 59 bool CanCreateBookmarkApp() const; |
| 60 | 60 |
| 61 void UpdateShortcutOnLoadComplete() { | 61 void UpdateShortcutOnLoadComplete() { |
| 62 update_shortcut_on_load_complete_ = true; | 62 update_shortcut_on_load_complete_ = true; |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 explicit TabHelper(content::WebContents* web_contents); | 136 explicit TabHelper(content::WebContents* web_contents); |
| 137 friend class content::WebContentsUserData<TabHelper>; | 137 friend class content::WebContentsUserData<TabHelper>; |
| 138 | 138 |
| 139 // Displays UI for completion of creating a bookmark hosted app. | 139 // Displays UI for completion of creating a bookmark hosted app. |
| 140 void FinishCreateBookmarkApp(const extensions::Extension* extension, | 140 void FinishCreateBookmarkApp(const extensions::Extension* extension, |
| 141 const WebApplicationInfo& web_app_info); | 141 const WebApplicationInfo& web_app_info); |
| 142 | 142 |
| 143 // content::WebContentsObserver overrides. | 143 // content::WebContentsObserver overrides. |
| 144 virtual void RenderViewCreated( | 144 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
| 145 content::RenderViewHost* render_view_host) override; | 145 void DidNavigateMainFrame( |
| 146 virtual void DidNavigateMainFrame( | |
| 147 const content::LoadCommittedDetails& details, | 146 const content::LoadCommittedDetails& details, |
| 148 const content::FrameNavigateParams& params) override; | 147 const content::FrameNavigateParams& params) override; |
| 149 virtual bool OnMessageReceived(const IPC::Message& message) override; | 148 bool OnMessageReceived(const IPC::Message& message) override; |
| 150 virtual bool OnMessageReceived( | 149 bool OnMessageReceived(const IPC::Message& message, |
| 151 const IPC::Message& message, | 150 content::RenderFrameHost* render_frame_host) override; |
| 152 content::RenderFrameHost* render_frame_host) override; | 151 void DidCloneToNewWebContents( |
| 153 virtual void DidCloneToNewWebContents( | |
| 154 content::WebContents* old_web_contents, | 152 content::WebContents* old_web_contents, |
| 155 content::WebContents* new_web_contents) override; | 153 content::WebContents* new_web_contents) override; |
| 156 | 154 |
| 157 // extensions::ExtensionFunctionDispatcher::Delegate overrides. | 155 // extensions::ExtensionFunctionDispatcher::Delegate overrides. |
| 158 virtual extensions::WindowController* GetExtensionWindowController() | 156 extensions::WindowController* GetExtensionWindowController() const override; |
| 159 const override; | 157 content::WebContents* GetAssociatedWebContents() const override; |
| 160 virtual content::WebContents* GetAssociatedWebContents() const override; | |
| 161 | 158 |
| 162 // Message handlers. | 159 // Message handlers. |
| 163 void OnDidGetWebApplicationInfo(const WebApplicationInfo& info); | 160 void OnDidGetWebApplicationInfo(const WebApplicationInfo& info); |
| 164 void OnInlineWebstoreInstall(int install_id, | 161 void OnInlineWebstoreInstall(int install_id, |
| 165 int return_route_id, | 162 int return_route_id, |
| 166 const std::string& webstore_item_id, | 163 const std::string& webstore_item_id, |
| 167 const GURL& requestor_url, | 164 const GURL& requestor_url, |
| 168 int listeners_mask); | 165 int listeners_mask); |
| 169 void OnGetAppInstallState(const GURL& requestor_url, | 166 void OnGetAppInstallState(const GURL& requestor_url, |
| 170 int return_route_id, | 167 int return_route_id, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 190 void OnImageLoaded(const gfx::Image& image); | 187 void OnImageLoaded(const gfx::Image& image); |
| 191 | 188 |
| 192 // WebstoreStandaloneInstaller::Callback. | 189 // WebstoreStandaloneInstaller::Callback. |
| 193 virtual void OnInlineInstallComplete(int install_id, | 190 virtual void OnInlineInstallComplete(int install_id, |
| 194 int return_route_id, | 191 int return_route_id, |
| 195 bool success, | 192 bool success, |
| 196 const std::string& error, | 193 const std::string& error, |
| 197 webstore_install::Result result); | 194 webstore_install::Result result); |
| 198 | 195 |
| 199 // content::NotificationObserver. | 196 // content::NotificationObserver. |
| 200 virtual void Observe(int type, | 197 void Observe(int type, |
| 201 const content::NotificationSource& source, | 198 const content::NotificationSource& source, |
| 202 const content::NotificationDetails& details) override; | 199 const content::NotificationDetails& details) override; |
| 203 | 200 |
| 204 // Requests application info for the specified page. This is an asynchronous | 201 // Requests application info for the specified page. This is an asynchronous |
| 205 // request. The delegate is notified by way of OnDidGetApplicationInfo when | 202 // request. The delegate is notified by way of OnDidGetApplicationInfo when |
| 206 // the data is available. | 203 // the data is available. |
| 207 void GetApplicationInfo(WebAppAction action); | 204 void GetApplicationInfo(WebAppAction action); |
| 208 | 205 |
| 209 // Sends our tab ID to |render_view_host|. | 206 // Sends our tab ID to |render_view_host|. |
| 210 void SetTabId(content::RenderViewHost* render_view_host); | 207 void SetTabId(content::RenderViewHost* render_view_host); |
| 211 | 208 |
| 212 // Data for app extensions --------------------------------------------------- | 209 // Data for app extensions --------------------------------------------------- |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 256 |
| 260 // Vend weak pointers that can be invalidated to stop in-progress loads. | 257 // Vend weak pointers that can be invalidated to stop in-progress loads. |
| 261 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; | 258 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; |
| 262 | 259 |
| 263 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 260 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
| 264 }; | 261 }; |
| 265 | 262 |
| 266 } // namespace extensions | 263 } // namespace extensions |
| 267 | 264 |
| 268 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 265 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| OLD | NEW |