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 "chrome/browser/cancelable_request.h" | 11 #include "chrome/browser/cancelable_request.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/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" | 18 #include "chrome/common/string_ordinal.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 | 22 |
23 class AppNotification; | |
24 class ExtensionService; | 23 class ExtensionService; |
25 class PrefChangeRegistrar; | 24 class PrefChangeRegistrar; |
26 class Profile; | 25 class Profile; |
27 | 26 |
| 27 namespace extensions { |
| 28 class AppNotification; |
| 29 } |
| 30 |
28 // The handler for Javascript messages related to the "apps" view. | 31 // The handler for Javascript messages related to the "apps" view. |
29 class AppLauncherHandler : public content::WebUIMessageHandler, | 32 class AppLauncherHandler : public content::WebUIMessageHandler, |
30 public ExtensionUninstallDialog::Delegate, | 33 public ExtensionUninstallDialog::Delegate, |
31 public ExtensionInstallPrompt::Delegate, | 34 public ExtensionInstallPrompt::Delegate, |
32 public content::NotificationObserver { | 35 public content::NotificationObserver { |
33 public: | 36 public: |
34 explicit AppLauncherHandler(ExtensionService* extension_service); | 37 explicit AppLauncherHandler(ExtensionService* extension_service); |
35 virtual ~AppLauncherHandler(); | 38 virtual ~AppLauncherHandler(); |
36 | 39 |
37 // Populate a dictionary with the information from an extension. | 40 // Populate a dictionary with the information from an extension. |
38 static void CreateAppInfo( | 41 static void CreateAppInfo( |
39 const extensions::Extension* extension, | 42 const extensions::Extension* extension, |
40 const AppNotification* notification, | 43 const extensions::AppNotification* notification, |
41 ExtensionService* service, | 44 ExtensionService* service, |
42 base::DictionaryValue* value); | 45 base::DictionaryValue* value); |
43 | 46 |
44 // WebUIMessageHandler implementation. | 47 // WebUIMessageHandler implementation. |
45 virtual void RegisterMessages() OVERRIDE; | 48 virtual void RegisterMessages() OVERRIDE; |
46 | 49 |
47 // content::NotificationObserver | 50 // content::NotificationObserver |
48 virtual void Observe(int type, | 51 virtual void Observe(int type, |
49 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
50 const content::NotificationDetails& details) OVERRIDE; | 53 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // when the app is added to the page (via getAppsCallback or appAdded). | 206 // when the app is added to the page (via getAppsCallback or appAdded). |
204 std::string highlight_app_id_; | 207 std::string highlight_app_id_; |
205 | 208 |
206 // Hold state for favicon requests. | 209 // Hold state for favicon requests. |
207 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; | 210 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; |
208 | 211 |
209 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 212 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
210 }; | 213 }; |
211 | 214 |
212 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 215 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |