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" |
11 #include "base/prefs/public/pref_change_registrar.h" | 11 #include "base/prefs/public/pref_change_registrar.h" |
12 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.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/common/cancelable_task_tracker.h" | 15 #include "chrome/common/cancelable_task_tracker.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 "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
21 #include "sync/api/string_ordinal.h" | 21 #include "sync/api/string_ordinal.h" |
22 | 22 |
23 class ExtensionService; | 23 class ExtensionService; |
24 class PrefChangeRegistrar; | 24 class PrefChangeRegistrar; |
| 25 class PrefServiceSyncable; |
25 class Profile; | 26 class Profile; |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
28 class AppNotification; | 29 class AppNotification; |
29 } | 30 } |
30 | 31 |
31 // The handler for Javascript messages related to the "apps" view. | 32 // The handler for Javascript messages related to the "apps" view. |
32 class AppLauncherHandler : public content::WebUIMessageHandler, | 33 class AppLauncherHandler : public content::WebUIMessageHandler, |
33 public ExtensionUninstallDialog::Delegate, | 34 public ExtensionUninstallDialog::Delegate, |
34 public ExtensionInstallPrompt::Delegate, | 35 public ExtensionInstallPrompt::Delegate, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // action for UMA. | 96 // action for UMA. |
96 void HandleRecordAppLaunchByUrl(const base::ListValue* args); | 97 void HandleRecordAppLaunchByUrl(const base::ListValue* args); |
97 | 98 |
98 // Callback for "closeNotification" message. | 99 // Callback for "closeNotification" message. |
99 void HandleNotificationClose(const base::ListValue* args); | 100 void HandleNotificationClose(const base::ListValue* args); |
100 | 101 |
101 // Callback for "setNotificationsDisabled" message. | 102 // Callback for "setNotificationsDisabled" message. |
102 void HandleSetNotificationsDisabled(const base::ListValue* args); | 103 void HandleSetNotificationsDisabled(const base::ListValue* args); |
103 | 104 |
104 // Register app launcher preferences. | 105 // Register app launcher preferences. |
105 static void RegisterUserPrefs(PrefServiceBase* pref_service); | 106 static void RegisterUserPrefs(PrefServiceSyncable* pref_service); |
106 | 107 |
107 // Records the given type of app launch for UMA. | 108 // Records the given type of app launch for UMA. |
108 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket); | 109 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket); |
109 | 110 |
110 private: | 111 private: |
111 struct AppInstallInfo { | 112 struct AppInstallInfo { |
112 AppInstallInfo(); | 113 AppInstallInfo(); |
113 ~AppInstallInfo(); | 114 ~AppInstallInfo(); |
114 | 115 |
115 bool is_bookmark_app; | 116 bool is_bookmark_app; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // when the app is added to the page (via getAppsCallback or appAdded). | 202 // when the app is added to the page (via getAppsCallback or appAdded). |
202 std::string highlight_app_id_; | 203 std::string highlight_app_id_; |
203 | 204 |
204 // Used for favicon loading tasks. | 205 // Used for favicon loading tasks. |
205 CancelableTaskTracker cancelable_task_tracker_; | 206 CancelableTaskTracker cancelable_task_tracker_; |
206 | 207 |
207 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 208 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
208 }; | 209 }; |
209 | 210 |
210 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 211 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |