| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Callback for the "createAppShortcut" message. | 76 // Callback for the "createAppShortcut" message. |
| 77 void HandleCreateAppShortcut(const base::ListValue* args); | 77 void HandleCreateAppShortcut(const base::ListValue* args); |
| 78 | 78 |
| 79 // Callback for the "reorderApps" message. | 79 // Callback for the "reorderApps" message. |
| 80 void HandleReorderApps(const base::ListValue* args); | 80 void HandleReorderApps(const base::ListValue* args); |
| 81 | 81 |
| 82 // Callback for the "setPageIndex" message. | 82 // Callback for the "setPageIndex" message. |
| 83 void HandleSetPageIndex(const base::ListValue* args); | 83 void HandleSetPageIndex(const base::ListValue* args); |
| 84 | 84 |
| 85 // Callback for the "promoSeen" message. | |
| 86 void HandlePromoSeen(const base::ListValue* args); | |
| 87 | |
| 88 // Callback for the "saveAppPageName" message. | 85 // Callback for the "saveAppPageName" message. |
| 89 void HandleSaveAppPageName(const base::ListValue* args); | 86 void HandleSaveAppPageName(const base::ListValue* args); |
| 90 | 87 |
| 91 // Callback for the "generateAppForLink" message. | 88 // Callback for the "generateAppForLink" message. |
| 92 void HandleGenerateAppForLink(const base::ListValue* args); | 89 void HandleGenerateAppForLink(const base::ListValue* args); |
| 93 | 90 |
| 94 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a | 91 // Callback for the "recordAppLaunchByURL" message. Takes an escaped URL and a |
| 95 // launch source (integer), and if the URL represents an app, records the | 92 // launch source (integer), and if the URL represents an app, records the |
| 96 // action for UMA. | 93 // action for UMA. |
| 97 void HandleRecordAppLaunchByURL(const base::ListValue* args); | 94 void HandleRecordAppLaunchByURL(const base::ListValue* args); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 115 | 112 |
| 116 bool is_bookmark_app; | 113 bool is_bookmark_app; |
| 117 string16 title; | 114 string16 title; |
| 118 GURL app_url; | 115 GURL app_url; |
| 119 StringOrdinal page_ordinal; | 116 StringOrdinal page_ordinal; |
| 120 }; | 117 }; |
| 121 | 118 |
| 122 // Reset some instance flags we use to track the currently uninstalling app. | 119 // Reset some instance flags we use to track the currently uninstalling app. |
| 123 void CleanupAfterUninstall(); | 120 void CleanupAfterUninstall(); |
| 124 | 121 |
| 125 // Records a web store launch in the appropriate histograms. |promo_active| | 122 // Records a web store launch in the appropriate histograms. |
| 126 // specifies if the web store promotion was active. | 123 static void RecordWebStoreLaunch(); |
| 127 static void RecordWebStoreLaunch(bool promo_active); | |
| 128 | 124 |
| 129 // Records an app launch in the corresponding |bucket| of the app launch | 125 // Records an app launch in the corresponding |bucket| of the app launch |
| 130 // histogram. |promo_active| specifies if the web store promotion was active. | 126 // histogram. |promo_active| specifies if the web store promotion was active. |
| 131 static void RecordAppLaunchByID(extension_misc::AppLaunchBucket bucket); | 127 static void RecordAppLaunchByID(extension_misc::AppLaunchBucket bucket); |
| 132 | 128 |
| 133 // 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 |
| 134 // histogram if the |escaped_url| corresponds to an installed app. | 130 // histogram if the |escaped_url| corresponds to an installed app. |
| 135 static void RecordAppLaunchByURL(Profile* profile, | 131 static void RecordAppLaunchByURL(Profile* profile, |
| 136 std::string escaped_url, | 132 std::string escaped_url, |
| 137 extension_misc::AppLaunchBucket bucket); | 133 extension_misc::AppLaunchBucket bucket); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 148 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 144 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
| 149 | 145 |
| 150 // Returns the ExtensionUninstallDialog object for this class, creating it if | 146 // Returns the ExtensionUninstallDialog object for this class, creating it if |
| 151 // needed. | 147 // needed. |
| 152 ExtensionUninstallDialog* GetExtensionUninstallDialog(); | 148 ExtensionUninstallDialog* GetExtensionUninstallDialog(); |
| 153 | 149 |
| 154 // Returns the ExtensionInstallPrompt object for this class, creating it if | 150 // Returns the ExtensionInstallPrompt object for this class, creating it if |
| 155 // needed. | 151 // needed. |
| 156 ExtensionInstallPrompt* GetExtensionInstallPrompt(); | 152 ExtensionInstallPrompt* GetExtensionInstallPrompt(); |
| 157 | 153 |
| 158 // Helper that uninstalls all the default apps. | |
| 159 void UninstallDefaultApps(); | |
| 160 | |
| 161 // Continuation for installing a bookmark app after favicon lookup. | 154 // Continuation for installing a bookmark app after favicon lookup. |
| 162 void OnFaviconForApp(FaviconService::Handle handle, | 155 void OnFaviconForApp(FaviconService::Handle handle, |
| 163 history::FaviconData data); | 156 history::FaviconData data); |
| 164 | 157 |
| 165 // Sends |highlight_app_id_| to the js. | 158 // Sends |highlight_app_id_| to the js. |
| 166 void SetAppToBeHighlighted(); | 159 void SetAppToBeHighlighted(); |
| 167 | 160 |
| 168 // The apps are represented in the extensions model, which | 161 // The apps are represented in the extensions model, which |
| 169 // outlives us since it's owned by our containing profile. | 162 // outlives us since it's owned by our containing profile. |
| 170 ExtensionService* const extension_service_; | 163 ExtensionService* const extension_service_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 201 // when the app is added to the page (via getAppsCallback or appAdded). | 194 // when the app is added to the page (via getAppsCallback or appAdded). |
| 202 std::string highlight_app_id_; | 195 std::string highlight_app_id_; |
| 203 | 196 |
| 204 // Hold state for favicon requests. | 197 // Hold state for favicon requests. |
| 205 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; | 198 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; |
| 206 | 199 |
| 207 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 200 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
| 208 }; | 201 }; |
| 209 | 202 |
| 210 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 203 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
| OLD | NEW |