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