OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_APP_LAUNCHER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ |
6 #define CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/dom_ui/dom_ui.h" | 10 #include "chrome/browser/dom_ui/dom_ui.h" |
11 #include "chrome/browser/extensions/extension_install_ui.h" | 11 #include "chrome/browser/extensions/extension_install_ui.h" |
12 #include "chrome/browser/prefs/pref_change_registrar.h" | 12 #include "chrome/browser/prefs/pref_change_registrar.h" |
13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
15 | 15 |
16 class Extension; | 16 class Extension; |
17 class ExtensionPrefs; | 17 class ExtensionPrefs; |
18 class ExtensionsService; | 18 class ExtensionService; |
19 class NotificationRegistrar; | 19 class NotificationRegistrar; |
20 class PrefChangeRegistrar; | 20 class PrefChangeRegistrar; |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 class Rect; | 23 class Rect; |
24 } | 24 } |
25 | 25 |
26 // The handler for Javascript messages related to the "apps" view. | 26 // The handler for Javascript messages related to the "apps" view. |
27 class AppLauncherHandler | 27 class AppLauncherHandler |
28 : public DOMMessageHandler, | 28 : public DOMMessageHandler, |
29 public ExtensionInstallUI::Delegate, | 29 public ExtensionInstallUI::Delegate, |
30 public NotificationObserver { | 30 public NotificationObserver { |
31 public: | 31 public: |
32 explicit AppLauncherHandler(ExtensionsService* extension_service); | 32 explicit AppLauncherHandler(ExtensionService* extension_service); |
33 virtual ~AppLauncherHandler(); | 33 virtual ~AppLauncherHandler(); |
34 | 34 |
35 // Populate a dictionary with the information from an extension. | 35 // Populate a dictionary with the information from an extension. |
36 static void CreateAppInfo(const Extension* extension, | 36 static void CreateAppInfo(const Extension* extension, |
37 ExtensionPrefs* extension_prefs, | 37 ExtensionPrefs* extension_prefs, |
38 DictionaryValue* value); | 38 DictionaryValue* value); |
39 | 39 |
40 // Callback for pings related to launching apps on the NTP. | 40 // Callback for pings related to launching apps on the NTP. |
41 static bool HandlePing(const std::string& path); | 41 static bool HandlePing(const std::string& path); |
42 | 42 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void InstallUIAbort(); | 85 virtual void InstallUIAbort(); |
86 | 86 |
87 // Returns the ExtensionInstallUI object for this class, creating it if | 87 // Returns the ExtensionInstallUI object for this class, creating it if |
88 // needed. | 88 // needed. |
89 ExtensionInstallUI* GetExtensionInstallUI(); | 89 ExtensionInstallUI* GetExtensionInstallUI(); |
90 | 90 |
91 // Starts the animation of the app icon. | 91 // Starts the animation of the app icon. |
92 void AnimateAppIcon(const Extension* extension, const gfx::Rect& rect); | 92 void AnimateAppIcon(const Extension* extension, const gfx::Rect& rect); |
93 | 93 |
94 // The apps are represented in the extensions model. | 94 // The apps are represented in the extensions model. |
95 scoped_refptr<ExtensionsService> extensions_service_; | 95 scoped_refptr<ExtensionService> extensions_service_; |
96 | 96 |
97 // We monitor changes to the extension system so that we can reload the apps | 97 // We monitor changes to the extension system so that we can reload the apps |
98 // when necessary. | 98 // when necessary. |
99 NotificationRegistrar registrar_; | 99 NotificationRegistrar registrar_; |
100 | 100 |
101 // Monitor extension preference changes so that the DOM UI can be notified. | 101 // Monitor extension preference changes so that the DOM UI can be notified. |
102 PrefChangeRegistrar pref_change_registrar_; | 102 PrefChangeRegistrar pref_change_registrar_; |
103 | 103 |
104 // Used to show confirmation UI for uninstalling/enabling extensions in | 104 // Used to show confirmation UI for uninstalling/enabling extensions in |
105 // incognito mode. | 105 // incognito mode. |
106 scoped_ptr<ExtensionInstallUI> install_ui_; | 106 scoped_ptr<ExtensionInstallUI> install_ui_; |
107 | 107 |
108 // The id of the extension we are prompting the user about. | 108 // The id of the extension we are prompting the user about. |
109 std::string extension_id_prompting_; | 109 std::string extension_id_prompting_; |
110 | 110 |
111 // Whether the promo is currently being shown. | 111 // Whether the promo is currently being shown. |
112 bool promo_active_; | 112 bool promo_active_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 114 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
115 }; | 115 }; |
116 | 116 |
117 #endif // CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ | 117 #endif // CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |