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 <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Per-tab extension helper. Also handles non-extension apps. | 44 // Per-tab extension helper. Also handles non-extension apps. |
45 class TabHelper : public content::WebContentsObserver, | 45 class TabHelper : public content::WebContentsObserver, |
46 public ExtensionFunctionDispatcher::Delegate, | 46 public ExtensionFunctionDispatcher::Delegate, |
47 public ExtensionRegistryObserver, | 47 public ExtensionRegistryObserver, |
48 public content::NotificationObserver, | 48 public content::NotificationObserver, |
49 public content::WebContentsUserData<TabHelper> { | 49 public content::WebContentsUserData<TabHelper> { |
50 public: | 50 public: |
51 ~TabHelper() override; | 51 ~TabHelper() override; |
52 | 52 |
53 void CreateApplicationShortcuts(); | |
54 void CreateHostedAppFromWebContents(); | 53 void CreateHostedAppFromWebContents(); |
55 bool CanCreateApplicationShortcuts() const; | |
56 bool CanCreateBookmarkApp() const; | 54 bool CanCreateBookmarkApp() const; |
57 | 55 |
58 void UpdateShortcutOnLoadComplete() { | 56 void UpdateShortcutOnLoadComplete() { |
59 update_shortcut_on_load_complete_ = true; | 57 update_shortcut_on_load_complete_ = true; |
60 } | 58 } |
61 | 59 |
62 // ScriptExecutionObserver::Delegate | 60 // ScriptExecutionObserver::Delegate |
63 virtual void AddScriptExecutionObserver(ScriptExecutionObserver* observer); | 61 virtual void AddScriptExecutionObserver(ScriptExecutionObserver* observer); |
64 virtual void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer); | 62 virtual void RemoveScriptExecutionObserver(ScriptExecutionObserver* observer); |
65 | 63 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 121 |
124 // Utility function to invoke member functions on all relevant | 122 // Utility function to invoke member functions on all relevant |
125 // ContentRulesRegistries. | 123 // ContentRulesRegistries. |
126 template <class Func> | 124 template <class Func> |
127 void InvokeForContentRulesRegistries(const Func& func); | 125 void InvokeForContentRulesRegistries(const Func& func); |
128 | 126 |
129 // Different types of action when web app info is available. | 127 // Different types of action when web app info is available. |
130 // OnDidGetApplicationInfo uses this to dispatch calls. | 128 // OnDidGetApplicationInfo uses this to dispatch calls. |
131 enum WebAppAction { | 129 enum WebAppAction { |
132 NONE, // No action at all. | 130 NONE, // No action at all. |
133 CREATE_SHORTCUT, // Bring up create application shortcut dialog. | |
134 CREATE_HOSTED_APP, // Create and install a hosted app. | 131 CREATE_HOSTED_APP, // Create and install a hosted app. |
135 UPDATE_SHORTCUT // Update icon for app shortcut. | 132 UPDATE_SHORTCUT // Update icon for app shortcut. |
136 }; | 133 }; |
137 | 134 |
138 explicit TabHelper(content::WebContents* web_contents); | 135 explicit TabHelper(content::WebContents* web_contents); |
139 friend class content::WebContentsUserData<TabHelper>; | 136 friend class content::WebContentsUserData<TabHelper>; |
140 | 137 |
141 // Displays UI for completion of creating a bookmark hosted app. | 138 // Displays UI for completion of creating a bookmark hosted app. |
142 void FinishCreateBookmarkApp(const extensions::Extension* extension, | 139 void FinishCreateBookmarkApp(const extensions::Extension* extension, |
143 const WebApplicationInfo& web_app_info); | 140 const WebApplicationInfo& web_app_info); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 275 |
279 // Generic weak ptr factory for posting callbacks. | 276 // Generic weak ptr factory for posting callbacks. |
280 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; | 277 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; |
281 | 278 |
282 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 279 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
283 }; | 280 }; |
284 | 281 |
285 } // namespace extensions | 282 } // namespace extensions |
286 | 283 |
287 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 284 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
OLD | NEW |