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