| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public WebContentsUserData<TabHelper> { | 44 public WebContentsUserData<TabHelper> { |
| 45 public: | 45 public: |
| 46 // Different types of action when web app info is available. | 46 // Different types of action when web app info is available. |
| 47 // OnDidGetApplicationInfo uses this to dispatch calls. | 47 // OnDidGetApplicationInfo uses this to dispatch calls. |
| 48 enum WebAppAction { | 48 enum WebAppAction { |
| 49 NONE, // No action at all. | 49 NONE, // No action at all. |
| 50 CREATE_SHORTCUT, // Bring up create application shortcut dialog. | 50 CREATE_SHORTCUT, // Bring up create application shortcut dialog. |
| 51 UPDATE_SHORTCUT // Update icon for app shortcut. | 51 UPDATE_SHORTCUT // Update icon for app shortcut. |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 explicit TabHelper(content::WebContents* web_contents); | |
| 55 virtual ~TabHelper(); | 54 virtual ~TabHelper(); |
| 56 static int kUserDataKey; | |
| 57 | 55 |
| 58 void CreateApplicationShortcuts(); | 56 void CreateApplicationShortcuts(); |
| 59 bool CanCreateApplicationShortcuts() const; | 57 bool CanCreateApplicationShortcuts() const; |
| 60 | 58 |
| 61 void set_pending_web_app_action(WebAppAction action) { | 59 void set_pending_web_app_action(WebAppAction action) { |
| 62 pending_web_app_action_ = action; | 60 pending_web_app_action_ = action; |
| 63 } | 61 } |
| 64 | 62 |
| 65 // App extensions ------------------------------------------------------------ | 63 // App extensions ------------------------------------------------------------ |
| 66 | 64 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 106 |
| 109 ActiveTabPermissionManager* active_tab_permission_manager() { | 107 ActiveTabPermissionManager* active_tab_permission_manager() { |
| 110 return active_tab_permission_manager_.get(); | 108 return active_tab_permission_manager_.get(); |
| 111 } | 109 } |
| 112 | 110 |
| 113 // Sets a non-extension app icon associated with WebContents and fires an | 111 // Sets a non-extension app icon associated with WebContents and fires an |
| 114 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 112 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
| 115 void SetAppIcon(const SkBitmap& app_icon); | 113 void SetAppIcon(const SkBitmap& app_icon); |
| 116 | 114 |
| 117 private: | 115 private: |
| 116 explicit TabHelper(content::WebContents* web_contents); |
| 117 static int kUserDataKey; |
| 118 friend class WebContentsUserData<TabHelper>; |
| 119 |
| 118 // content::WebContentsObserver overrides. | 120 // content::WebContentsObserver overrides. |
| 119 virtual void RenderViewCreated( | 121 virtual void RenderViewCreated( |
| 120 content::RenderViewHost* render_view_host) OVERRIDE; | 122 content::RenderViewHost* render_view_host) OVERRIDE; |
| 121 virtual void DidNavigateMainFrame( | 123 virtual void DidNavigateMainFrame( |
| 122 const content::LoadCommittedDetails& details, | 124 const content::LoadCommittedDetails& details, |
| 123 const content::FrameNavigateParams& params) OVERRIDE; | 125 const content::FrameNavigateParams& params) OVERRIDE; |
| 124 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 126 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 125 virtual void DidCloneToNewWebContents( | 127 virtual void DidCloneToNewWebContents( |
| 126 content::WebContents* old_web_contents, | 128 content::WebContents* old_web_contents, |
| 127 content::WebContents* new_web_contents) OVERRIDE; | 129 content::WebContents* new_web_contents) OVERRIDE; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 scoped_ptr<LocationBarController> location_bar_controller_; | 220 scoped_ptr<LocationBarController> location_bar_controller_; |
| 219 | 221 |
| 220 scoped_ptr<ActiveTabPermissionManager> active_tab_permission_manager_; | 222 scoped_ptr<ActiveTabPermissionManager> active_tab_permission_manager_; |
| 221 | 223 |
| 222 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 224 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
| 223 }; | 225 }; |
| 224 | 226 |
| 225 } // namespace extensions | 227 } // namespace extensions |
| 226 | 228 |
| 227 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 229 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
| OLD | NEW |