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 PrefRegistrySyncable; | 27 class PrefRegistrySyncable; |
28 class Profile; | 28 class Profile; |
29 | 29 |
30 namespace extensions { | |
31 class AppNotification; | |
32 } | |
33 | |
34 // The handler for Javascript messages related to the "apps" view. | 30 // The handler for Javascript messages related to the "apps" view. |
35 class AppLauncherHandler : public content::WebUIMessageHandler, | 31 class AppLauncherHandler : public content::WebUIMessageHandler, |
36 public ExtensionUninstallDialog::Delegate, | 32 public ExtensionUninstallDialog::Delegate, |
37 public ExtensionEnableFlowDelegate, | 33 public ExtensionEnableFlowDelegate, |
38 public content::NotificationObserver { | 34 public content::NotificationObserver { |
39 public: | 35 public: |
40 explicit AppLauncherHandler(ExtensionService* extension_service); | 36 explicit AppLauncherHandler(ExtensionService* extension_service); |
41 virtual ~AppLauncherHandler(); | 37 virtual ~AppLauncherHandler(); |
42 | 38 |
43 // Populate a dictionary with the information from an extension. | 39 // Populate a dictionary with the information from an extension. |
44 static void CreateAppInfo( | 40 static void CreateAppInfo( |
45 const extensions::Extension* extension, | 41 const extensions::Extension* extension, |
46 const extensions::AppNotification* notification, | |
47 ExtensionService* service, | 42 ExtensionService* service, |
48 base::DictionaryValue* value); | 43 base::DictionaryValue* value); |
49 | 44 |
50 // WebUIMessageHandler implementation. | 45 // WebUIMessageHandler implementation. |
51 virtual void RegisterMessages() OVERRIDE; | 46 virtual void RegisterMessages() OVERRIDE; |
52 | 47 |
53 // content::NotificationObserver | 48 // content::NotificationObserver |
54 virtual void Observe(int type, | 49 virtual void Observe(int type, |
55 const content::NotificationSource& source, | 50 const content::NotificationSource& source, |
56 const content::NotificationDetails& details) OVERRIDE; | 51 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // when the app is added to the page (via getAppsCallback or appAdded). | 196 // when the app is added to the page (via getAppsCallback or appAdded). |
202 std::string highlight_app_id_; | 197 std::string highlight_app_id_; |
203 | 198 |
204 // Used for favicon loading tasks. | 199 // Used for favicon loading tasks. |
205 CancelableTaskTracker cancelable_task_tracker_; | 200 CancelableTaskTracker cancelable_task_tracker_; |
206 | 201 |
207 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 202 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
208 }; | 203 }; |
209 | 204 |
210 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 205 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |