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 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/extensions/extension_install_ui.h" | 12 #include "chrome/browser/extensions/extension_install_ui.h" |
13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
14 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
15 #include "chrome/browser/prefs/pref_change_registrar.h" | 15 #include "chrome/browser/prefs/pref_change_registrar.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/common/string_ordinal.h" |
18 #include "content/browser/cancelable_request.h" | 19 #include "content/browser/cancelable_request.h" |
19 #include "content/browser/webui/web_ui.h" | 20 #include "content/browser/webui/web_ui.h" |
20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
22 | 23 |
23 class AppNotification; | 24 class AppNotification; |
24 class ExtensionService; | 25 class ExtensionService; |
25 class PrefChangeRegistrar; | 26 class PrefChangeRegistrar; |
26 class Profile; | 27 class Profile; |
27 | 28 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void HandleNotificationClose(const base::ListValue* args); | 108 void HandleNotificationClose(const base::ListValue* args); |
108 | 109 |
109 // Callback for "setNotificationsDisabled" message. | 110 // Callback for "setNotificationsDisabled" message. |
110 void HandleSetNotificationsDisabled(const base::ListValue* args); | 111 void HandleSetNotificationsDisabled(const base::ListValue* args); |
111 | 112 |
112 // Register app launcher preferences. | 113 // Register app launcher preferences. |
113 static void RegisterUserPrefs(PrefService* pref_service); | 114 static void RegisterUserPrefs(PrefService* pref_service); |
114 | 115 |
115 private: | 116 private: |
116 struct AppInstallInfo { | 117 struct AppInstallInfo { |
| 118 AppInstallInfo(); |
| 119 ~AppInstallInfo(); |
| 120 |
117 bool is_bookmark_app; | 121 bool is_bookmark_app; |
118 string16 title; | 122 string16 title; |
119 GURL app_url; | 123 GURL app_url; |
120 int page_index; | 124 StringOrdinal page_ordinal; |
121 }; | 125 }; |
122 | 126 |
123 // Records a web store launch in the appropriate histograms. |promo_active| | 127 // Records a web store launch in the appropriate histograms. |promo_active| |
124 // specifies if the web store promotion was active. | 128 // specifies if the web store promotion was active. |
125 static void RecordWebStoreLaunch(bool promo_active); | 129 static void RecordWebStoreLaunch(bool promo_active); |
126 | 130 |
127 // 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 |
128 // histogram. |promo_active| specifies if the web store promotion was active. | 132 // histogram. |promo_active| specifies if the web store promotion was active. |
129 static void RecordAppLaunchByID(extension_misc::AppLaunchBucket bucket); | 133 static void RecordAppLaunchByID(extension_misc::AppLaunchBucket bucket); |
130 | 134 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // when the app is added to the page (via getAppsCallback or appAdded). | 203 // when the app is added to the page (via getAppsCallback or appAdded). |
200 std::string highlight_app_id_; | 204 std::string highlight_app_id_; |
201 | 205 |
202 // Hold state for favicon requests. | 206 // Hold state for favicon requests. |
203 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; | 207 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; |
204 | 208 |
205 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 209 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
206 }; | 210 }; |
207 | 211 |
208 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 212 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |