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_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 class ExtensionEnableFlow; | 25 class ExtensionEnableFlow; |
26 class ExtensionService; | 26 class ExtensionService; |
27 class PrefChangeRegistrar; | 27 class PrefChangeRegistrar; |
28 class Profile; | 28 class Profile; |
29 | 29 |
30 namespace favicon_base { | 30 namespace favicon_base { |
31 struct FaviconImageResult; | 31 struct FaviconImageResult; |
32 } | 32 } |
33 | 33 |
34 // The handler for Javascript messages related to the "apps" view. | 34 // The handler for Javascript messages related to the "apps" view. |
35 class AppLauncherHandler : public content::WebUIMessageHandler, | 35 class AppLauncherHandler |
36 public ExtensionUninstallDialog::Delegate, | 36 : public content::WebUIMessageHandler, |
37 public ExtensionEnableFlowDelegate, | 37 public extensions::ExtensionUninstallDialog::Delegate, |
38 public content::NotificationObserver { | 38 public ExtensionEnableFlowDelegate, |
| 39 public content::NotificationObserver { |
39 public: | 40 public: |
40 explicit AppLauncherHandler(ExtensionService* extension_service); | 41 explicit AppLauncherHandler(ExtensionService* extension_service); |
41 virtual ~AppLauncherHandler(); | 42 virtual ~AppLauncherHandler(); |
42 | 43 |
43 // Populate a dictionary with the information from an extension. | 44 // Populate a dictionary with the information from an extension. |
44 static void CreateAppInfo( | 45 static void CreateAppInfo( |
45 const extensions::Extension* extension, | 46 const extensions::Extension* extension, |
46 ExtensionService* service, | 47 ExtensionService* service, |
47 base::DictionaryValue* value); | 48 base::DictionaryValue* value); |
48 | 49 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // ExtensionUninstallDialog::Delegate: | 126 // ExtensionUninstallDialog::Delegate: |
126 virtual void ExtensionUninstallAccepted() OVERRIDE; | 127 virtual void ExtensionUninstallAccepted() OVERRIDE; |
127 virtual void ExtensionUninstallCanceled() OVERRIDE; | 128 virtual void ExtensionUninstallCanceled() OVERRIDE; |
128 | 129 |
129 // ExtensionEnableFlowDelegate: | 130 // ExtensionEnableFlowDelegate: |
130 virtual void ExtensionEnableFlowFinished() OVERRIDE; | 131 virtual void ExtensionEnableFlowFinished() OVERRIDE; |
131 virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE; | 132 virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE; |
132 | 133 |
133 // Returns the ExtensionUninstallDialog object for this class, creating it if | 134 // Returns the ExtensionUninstallDialog object for this class, creating it if |
134 // needed. | 135 // needed. |
135 ExtensionUninstallDialog* GetExtensionUninstallDialog(); | 136 extensions::ExtensionUninstallDialog* GetExtensionUninstallDialog(); |
136 | 137 |
137 // Continuation for installing a bookmark app after favicon lookup. | 138 // Continuation for installing a bookmark app after favicon lookup. |
138 void OnFaviconForApp(scoped_ptr<AppInstallInfo> install_info, | 139 void OnFaviconForApp(scoped_ptr<AppInstallInfo> install_info, |
139 const favicon_base::FaviconImageResult& image_result); | 140 const favicon_base::FaviconImageResult& image_result); |
140 | 141 |
141 // Sends |highlight_app_id_| to the js. | 142 // Sends |highlight_app_id_| to the js. |
142 void SetAppToBeHighlighted(); | 143 void SetAppToBeHighlighted(); |
143 | 144 |
144 void OnExtensionPreferenceChanged(); | 145 void OnExtensionPreferenceChanged(); |
145 | 146 |
146 void OnLocalStatePreferenceChanged(); | 147 void OnLocalStatePreferenceChanged(); |
147 | 148 |
148 // The apps are represented in the extensions model, which | 149 // The apps are represented in the extensions model, which |
149 // outlives us since it's owned by our containing profile. | 150 // outlives us since it's owned by our containing profile. |
150 ExtensionService* const extension_service_; | 151 ExtensionService* const extension_service_; |
151 | 152 |
152 // We monitor changes to the extension system so that we can reload the apps | 153 // We monitor changes to the extension system so that we can reload the apps |
153 // when necessary. | 154 // when necessary. |
154 content::NotificationRegistrar registrar_; | 155 content::NotificationRegistrar registrar_; |
155 | 156 |
156 // Monitor extension preference changes so that the Web UI can be notified. | 157 // Monitor extension preference changes so that the Web UI can be notified. |
157 PrefChangeRegistrar extension_pref_change_registrar_; | 158 PrefChangeRegistrar extension_pref_change_registrar_; |
158 | 159 |
159 // Monitor the local state pref to control the app launcher promo. | 160 // Monitor the local state pref to control the app launcher promo. |
160 PrefChangeRegistrar local_state_pref_change_registrar_; | 161 PrefChangeRegistrar local_state_pref_change_registrar_; |
161 | 162 |
162 // Used to show confirmation UI for uninstalling extensions in incognito mode. | 163 // Used to show confirmation UI for uninstalling extensions in incognito mode. |
163 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 164 scoped_ptr<extensions::ExtensionUninstallDialog> extension_uninstall_dialog_; |
164 | 165 |
165 // Used to show confirmation UI for enabling extensions. | 166 // Used to show confirmation UI for enabling extensions. |
166 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; | 167 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; |
167 | 168 |
168 // The ids of apps to show on the NTP. | 169 // The ids of apps to show on the NTP. |
169 std::set<std::string> visible_apps_; | 170 std::set<std::string> visible_apps_; |
170 | 171 |
171 // The id of the extension we are prompting the user about (either enable or | 172 // The id of the extension we are prompting the user about (either enable or |
172 // uninstall). | 173 // uninstall). |
173 std::string extension_id_prompting_; | 174 std::string extension_id_prompting_; |
(...skipping 14 matching lines...) Expand all Loading... |
188 // when the app is added to the page (via getAppsCallback or appAdded). | 189 // when the app is added to the page (via getAppsCallback or appAdded). |
189 std::string highlight_app_id_; | 190 std::string highlight_app_id_; |
190 | 191 |
191 // Used for favicon loading tasks. | 192 // Used for favicon loading tasks. |
192 base::CancelableTaskTracker cancelable_task_tracker_; | 193 base::CancelableTaskTracker cancelable_task_tracker_; |
193 | 194 |
194 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 195 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
195 }; | 196 }; |
196 | 197 |
197 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 198 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |