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