OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // it is special (such as the Web Store app). | 43 // it is special (such as the Web Store app). |
44 static bool IsAppExcludedFromList(const Extension* extension); | 44 static bool IsAppExcludedFromList(const Extension* extension); |
45 | 45 |
46 // Populate a dictionary with the information from an extension. | 46 // Populate a dictionary with the information from an extension. |
47 static void CreateAppInfo( | 47 static void CreateAppInfo( |
48 const Extension* extension, | 48 const Extension* extension, |
49 const AppNotification* notification, | 49 const AppNotification* notification, |
50 ExtensionService* service, | 50 ExtensionService* service, |
51 base::DictionaryValue* value); | 51 base::DictionaryValue* value); |
52 | 52 |
53 // Callback for pings related to launching apps on the NTP. | |
54 static bool HandlePing(Profile* profile, const std::string& path); | |
55 | |
56 // WebUIMessageHandler implementation. | 53 // WebUIMessageHandler implementation. |
57 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; | 54 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; |
58 virtual void RegisterMessages() OVERRIDE; | 55 virtual void RegisterMessages() OVERRIDE; |
59 | 56 |
60 // content::NotificationObserver | 57 // content::NotificationObserver |
61 virtual void Observe(int type, | 58 virtual void Observe(int type, |
62 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
63 const content::NotificationDetails& details) OVERRIDE; | 60 const content::NotificationDetails& details) OVERRIDE; |
64 | 61 |
65 // Populate the given dictionary with all installed app info. | 62 // Populate the given dictionary with all installed app info. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 GURL app_url; | 121 GURL app_url; |
125 int page_index; | 122 int page_index; |
126 }; | 123 }; |
127 | 124 |
128 // Records a web store launch in the appropriate histograms. |promo_active| | 125 // Records a web store launch in the appropriate histograms. |promo_active| |
129 // specifies if the web store promotion was active. | 126 // specifies if the web store promotion was active. |
130 static void RecordWebStoreLaunch(bool promo_active); | 127 static void RecordWebStoreLaunch(bool promo_active); |
131 | 128 |
132 // Records an app launch in the corresponding |bucket| of the app launch | 129 // Records an app launch in the corresponding |bucket| of the app launch |
133 // histogram. |promo_active| specifies if the web store promotion was active. | 130 // histogram. |promo_active| specifies if the web store promotion was active. |
134 static void RecordAppLaunchByID(bool promo_active, | 131 static void RecordAppLaunchByID(extension_misc::AppLaunchBucket bucket); |
135 extension_misc::AppLaunchBucket bucket); | |
136 | 132 |
137 // Records an app launch in the corresponding |bucket| of the app launch | 133 // Records an app launch in the corresponding |bucket| of the app launch |
138 // histogram if the |escaped_url| corresponds to an installed app. | 134 // histogram if the |escaped_url| corresponds to an installed app. |
139 static void RecordAppLaunchByURL(Profile* profile, | 135 static void RecordAppLaunchByURL(Profile* profile, |
140 std::string escaped_url, | 136 std::string escaped_url, |
141 extension_misc::AppLaunchBucket bucket); | 137 extension_misc::AppLaunchBucket bucket); |
142 | 138 |
143 // Prompts the user to re-enable the app for |extension_id|. | 139 // Prompts the user to re-enable the app for |extension_id|. |
144 void PromptToEnableApp(const std::string& extension_id); | 140 void PromptToEnableApp(const std::string& extension_id); |
145 | 141 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 178 |
183 // Used to show confirmation UI for uninstalling extensions in incognito mode. | 179 // Used to show confirmation UI for uninstalling extensions in incognito mode. |
184 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 180 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
185 | 181 |
186 // Used to show confirmation UI for enabling extensions in incognito mode. | 182 // Used to show confirmation UI for enabling extensions in incognito mode. |
187 scoped_ptr<ExtensionInstallUI> extension_install_ui_; | 183 scoped_ptr<ExtensionInstallUI> extension_install_ui_; |
188 | 184 |
189 // The id of the extension we are prompting the user about. | 185 // The id of the extension we are prompting the user about. |
190 std::string extension_id_prompting_; | 186 std::string extension_id_prompting_; |
191 | 187 |
192 // Whether the promo is currently being shown. | |
193 bool promo_active_; | |
194 | |
195 // When true, we ignore changes to the underlying data rather than immediately | 188 // When true, we ignore changes to the underlying data rather than immediately |
196 // refreshing. This is useful when making many batch updates to avoid flicker. | 189 // refreshing. This is useful when making many batch updates to avoid flicker. |
197 bool ignore_changes_; | 190 bool ignore_changes_; |
198 | 191 |
199 // When true, we have attempted to install a bookmark app, and are still | 192 // When true, we have attempted to install a bookmark app, and are still |
200 // waiting to hear about success or failure from the extensions system. | 193 // waiting to hear about success or failure from the extensions system. |
201 bool attempted_bookmark_app_install_; | 194 bool attempted_bookmark_app_install_; |
202 | 195 |
203 // True if we have executed HandleGetApps() at least once. | 196 // True if we have executed HandleGetApps() at least once. |
204 bool has_loaded_apps_; | 197 bool has_loaded_apps_; |
205 | 198 |
206 // The ID of the app to be highlighted on the NTP (i.e. shown on the page | 199 // The ID of the app to be highlighted on the NTP (i.e. shown on the page |
207 // and pulsed). This is done for new installs. The actual higlighting occurs | 200 // and pulsed). This is done for new installs. The actual higlighting occurs |
208 // when the app is added to the page (via getAppsCallback or appAdded). | 201 // when the app is added to the page (via getAppsCallback or appAdded). |
209 std::string highlight_app_id_; | 202 std::string highlight_app_id_; |
210 | 203 |
211 // Hold state for favicon requests. | 204 // Hold state for favicon requests. |
212 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; | 205 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; |
213 | 206 |
214 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 207 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
215 }; | 208 }; |
216 | 209 |
217 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 210 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |