| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 16 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
| 17 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 17 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 18 #include "chrome/common/web_application_info.h" | 18 #include "chrome/common/web_application_info.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "content/public/browser/web_contents_user_data.h" | 22 #include "content/public/browser/web_contents_user_data.h" |
| 23 #include "extensions/common/stack_frame.h" | 23 #include "extensions/common/stack_frame.h" |
| 24 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 25 | 25 |
| 26 class FaviconDownloader; |
| 27 |
| 26 namespace content { | 28 namespace content { |
| 27 struct LoadCommittedDetails; | 29 struct LoadCommittedDetails; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace gfx { | 32 namespace gfx { |
| 31 class Image; | 33 class Image; |
| 32 } | 34 } |
| 33 | 35 |
| 34 namespace extensions { | 36 namespace extensions { |
| 35 class Extension; | 37 class Extension; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 94 } |
| 93 | 95 |
| 94 void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer) { | 96 void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer) { |
| 95 script_execution_observers_.RemoveObserver(observer); | 97 script_execution_observers_.RemoveObserver(observer); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void CreateApplicationShortcuts(); | 100 void CreateApplicationShortcuts(); |
| 99 void CreateHostedAppFromWebContents(); | 101 void CreateHostedAppFromWebContents(); |
| 100 bool CanCreateApplicationShortcuts() const; | 102 bool CanCreateApplicationShortcuts() const; |
| 101 | 103 |
| 102 void CreateHostedApp(const WebApplicationInfo& info); | |
| 103 | |
| 104 void set_pending_web_app_action(WebAppAction action) { | 104 void set_pending_web_app_action(WebAppAction action) { |
| 105 pending_web_app_action_ = action; | 105 pending_web_app_action_ = action; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // App extensions ------------------------------------------------------------ | 108 // App extensions ------------------------------------------------------------ |
| 109 | 109 |
| 110 // Sets the extension denoting this as an app. If |extension| is non-null this | 110 // Sets the extension denoting this as an app. If |extension| is non-null this |
| 111 // tab becomes an app-tab. WebContents does not listen for unload events for | 111 // tab becomes an app-tab. WebContents does not listen for unload events for |
| 112 // the extension. It's up to consumers of WebContents to do that. | 112 // the extension. It's up to consumers of WebContents to do that. |
| 113 // | 113 // |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // Sets the factory used to create inline webstore item installers. | 164 // Sets the factory used to create inline webstore item installers. |
| 165 // Used for testing. Takes ownership of the factory instance. | 165 // Used for testing. Takes ownership of the factory instance. |
| 166 void SetWebstoreInlineInstallerFactoryForTests( | 166 void SetWebstoreInlineInstallerFactoryForTests( |
| 167 WebstoreInlineInstallerFactory* factory); | 167 WebstoreInlineInstallerFactory* factory); |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 explicit TabHelper(content::WebContents* web_contents); | 170 explicit TabHelper(content::WebContents* web_contents); |
| 171 friend class content::WebContentsUserData<TabHelper>; | 171 friend class content::WebContentsUserData<TabHelper>; |
| 172 | 172 |
| 173 // Creates a hosted app for the current tab. Requires the |web_app_info_| to |
| 174 // be populated. |
| 175 void CreateHostedApp(); |
| 176 void FinishCreateHostedApp( |
| 177 bool success, const std::map<GURL, std::vector<SkBitmap> >& bitmaps); |
| 178 |
| 173 // content::WebContentsObserver overrides. | 179 // content::WebContentsObserver overrides. |
| 174 virtual void RenderViewCreated( | 180 virtual void RenderViewCreated( |
| 175 content::RenderViewHost* render_view_host) OVERRIDE; | 181 content::RenderViewHost* render_view_host) OVERRIDE; |
| 176 virtual void DidNavigateMainFrame( | 182 virtual void DidNavigateMainFrame( |
| 177 const content::LoadCommittedDetails& details, | 183 const content::LoadCommittedDetails& details, |
| 178 const content::FrameNavigateParams& params) OVERRIDE; | 184 const content::FrameNavigateParams& params) OVERRIDE; |
| 179 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 185 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 180 virtual void DidCloneToNewWebContents( | 186 virtual void DidCloneToNewWebContents( |
| 181 content::WebContents* old_web_contents, | 187 content::WebContents* old_web_contents, |
| 182 content::WebContents* new_web_contents) OVERRIDE; | 188 content::WebContents* new_web_contents) OVERRIDE; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 content::NotificationRegistrar registrar_; | 268 content::NotificationRegistrar registrar_; |
| 263 | 269 |
| 264 scoped_ptr<ScriptExecutor> script_executor_; | 270 scoped_ptr<ScriptExecutor> script_executor_; |
| 265 | 271 |
| 266 scoped_ptr<LocationBarController> location_bar_controller_; | 272 scoped_ptr<LocationBarController> location_bar_controller_; |
| 267 | 273 |
| 268 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; | 274 scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_; |
| 269 | 275 |
| 270 scoped_ptr<ScriptBubbleController> script_bubble_controller_; | 276 scoped_ptr<ScriptBubbleController> script_bubble_controller_; |
| 271 | 277 |
| 278 scoped_ptr<FaviconDownloader> favicon_downloader_; |
| 279 |
| 272 Profile* profile_; | 280 Profile* profile_; |
| 273 | 281 |
| 274 // Vend weak pointers that can be invalidated to stop in-progress loads. | 282 // Vend weak pointers that can be invalidated to stop in-progress loads. |
| 275 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; | 283 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; |
| 276 | 284 |
| 277 // Creates WebstoreInlineInstaller instances for inline install triggers. | 285 // Creates WebstoreInlineInstaller instances for inline install triggers. |
| 278 scoped_ptr<WebstoreInlineInstallerFactory> webstore_inline_installer_factory_; | 286 scoped_ptr<WebstoreInlineInstallerFactory> webstore_inline_installer_factory_; |
| 279 | 287 |
| 280 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 288 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
| 281 }; | 289 }; |
| 282 | 290 |
| 283 } // namespace extensions | 291 } // namespace extensions |
| 284 | 292 |
| 285 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 293 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| OLD | NEW |