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