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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.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/managed_mode/scoped_extension_elevation.h" | 15 #include "chrome/browser/managed_mode/scoped_extension_elevation.h" |
16 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 16 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
17 #include "chrome/common/cancelable_task_tracker.h" | 17 #include "chrome/common/cancelable_task_tracker.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/web_ui_message_handler.h" | 22 #include "content/public/browser/web_ui_message_handler.h" |
23 #include "sync/api/string_ordinal.h" | 23 #include "sync/api/string_ordinal.h" |
24 | 24 |
25 class ExtensionEnableFlow; | 25 class ExtensionEnableFlow; |
26 class ExtensionService; | 26 class ExtensionService; |
27 class PrefChangeRegistrar; | 27 class PrefChangeRegistrar; |
| 28 class Profile; |
| 29 |
| 30 namespace user_prefs { |
28 class PrefRegistrySyncable; | 31 class PrefRegistrySyncable; |
29 class Profile; | 32 } |
30 | 33 |
31 // The handler for Javascript messages related to the "apps" view. | 34 // The handler for Javascript messages related to the "apps" view. |
32 class AppLauncherHandler : public content::WebUIMessageHandler, | 35 class AppLauncherHandler : public content::WebUIMessageHandler, |
33 public ExtensionUninstallDialog::Delegate, | 36 public ExtensionUninstallDialog::Delegate, |
34 public ExtensionEnableFlowDelegate, | 37 public ExtensionEnableFlowDelegate, |
35 public content::NotificationObserver { | 38 public content::NotificationObserver { |
36 public: | 39 public: |
37 explicit AppLauncherHandler(ExtensionService* extension_service); | 40 explicit AppLauncherHandler(ExtensionService* extension_service); |
38 virtual ~AppLauncherHandler(); | 41 virtual ~AppLauncherHandler(); |
39 | 42 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Callback for "stopShowingAppLauncherPromo" message. | 100 // Callback for "stopShowingAppLauncherPromo" message. |
98 void StopShowingAppLauncherPromo(const base::ListValue* args); | 101 void StopShowingAppLauncherPromo(const base::ListValue* args); |
99 | 102 |
100 // Callback for "closeNotification" message. | 103 // Callback for "closeNotification" message. |
101 void HandleNotificationClose(const base::ListValue* args); | 104 void HandleNotificationClose(const base::ListValue* args); |
102 | 105 |
103 // Callback for "setNotificationsDisabled" message. | 106 // Callback for "setNotificationsDisabled" message. |
104 void HandleSetNotificationsDisabled(const base::ListValue* args); | 107 void HandleSetNotificationsDisabled(const base::ListValue* args); |
105 | 108 |
106 // Register app launcher preferences. | 109 // Register app launcher preferences. |
107 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 110 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
108 | 111 |
109 // Records the given type of app launch for UMA. | 112 // Records the given type of app launch for UMA. |
110 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, | 113 static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket, |
111 extensions::Manifest::Type app_type); | 114 extensions::Manifest::Type app_type); |
112 | 115 |
113 private: | 116 private: |
114 struct AppInstallInfo { | 117 struct AppInstallInfo { |
115 AppInstallInfo(); | 118 AppInstallInfo(); |
116 ~AppInstallInfo(); | 119 ~AppInstallInfo(); |
117 | 120 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // when the app is added to the page (via getAppsCallback or appAdded). | 210 // when the app is added to the page (via getAppsCallback or appAdded). |
208 std::string highlight_app_id_; | 211 std::string highlight_app_id_; |
209 | 212 |
210 // Used for favicon loading tasks. | 213 // Used for favicon loading tasks. |
211 CancelableTaskTracker cancelable_task_tracker_; | 214 CancelableTaskTracker cancelable_task_tracker_; |
212 | 215 |
213 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 216 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
214 }; | 217 }; |
215 | 218 |
216 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 219 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |