OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/extension_app_api.h" | 10 #include "chrome/browser/extensions/extension_app_api.h" |
(...skipping 23 matching lines...) Expand all Loading... |
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 WebUIMessageHandler, | 35 class AppLauncherHandler : public WebUIMessageHandler, |
36 public ExtensionUninstallDialog::Delegate, | 36 public ExtensionUninstallDialog::Delegate, |
37 public ExtensionInstallUI::Delegate, | 37 public ExtensionInstallUI::Delegate, |
38 public NotificationObserver { | 38 public NotificationObserver { |
39 public: | 39 public: |
40 explicit AppLauncherHandler(ExtensionService* extension_service); | 40 explicit AppLauncherHandler(ExtensionService* extension_service); |
41 virtual ~AppLauncherHandler(); | 41 virtual ~AppLauncherHandler(); |
42 | 42 |
43 // Populate a dictionary with the information from an extension. | 43 // Populate a dictionary with the information from an extension. |
44 static void CreateAppInfo(const Extension* extension, | 44 static base::DictionaryValue* CreateAppInfo( |
45 const AppNotification* notification, | 45 const Extension* extension, |
46 ExtensionService* service, | 46 const AppNotification* notification, |
47 base::DictionaryValue* value); | 47 ExtensionService* service); |
48 | 48 |
49 // Callback for pings related to launching apps on the NTP. | 49 // Callback for pings related to launching apps on the NTP. |
50 static bool HandlePing(Profile* profile, const std::string& path); | 50 static bool HandlePing(Profile* profile, const std::string& path); |
51 | 51 |
52 // WebUIMessageHandler implementation. | 52 // WebUIMessageHandler implementation. |
53 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; | 53 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; |
54 virtual void RegisterMessages() OVERRIDE; | 54 virtual void RegisterMessages() OVERRIDE; |
55 | 55 |
56 // NotificationObserver | 56 // NotificationObserver |
57 virtual void Observe(int type, | 57 virtual void Observe(int type, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ExtensionInstallUI* GetExtensionInstallUI(); | 141 ExtensionInstallUI* GetExtensionInstallUI(); |
142 | 142 |
143 // Helper that uninstalls all the default apps. | 143 // Helper that uninstalls all the default apps. |
144 void UninstallDefaultApps(); | 144 void UninstallDefaultApps(); |
145 | 145 |
146 // Continuation for installing a bookmark app after favicon lookup. | 146 // Continuation for installing a bookmark app after favicon lookup. |
147 void OnFaviconForApp(FaviconService::Handle handle, | 147 void OnFaviconForApp(FaviconService::Handle handle, |
148 history::FaviconData data); | 148 history::FaviconData data); |
149 | 149 |
150 // The apps are represented in the extensions model, which | 150 // The apps are represented in the extensions model, which |
151 // outlives us since its owned by our containing profile. | 151 // outlives us since it's owned by our containing profile. |
152 ExtensionService* const extensions_service_; | 152 ExtensionService* const extension_service_; |
153 | 153 |
154 // We monitor changes to the extension system so that we can reload the apps | 154 // We monitor changes to the extension system so that we can reload the apps |
155 // when necessary. | 155 // when necessary. |
156 NotificationRegistrar registrar_; | 156 NotificationRegistrar registrar_; |
157 | 157 |
158 // Monitor extension preference changes so that the Web UI can be notified. | 158 // Monitor extension preference changes so that the Web UI can be notified. |
159 PrefChangeRegistrar pref_change_registrar_; | 159 PrefChangeRegistrar pref_change_registrar_; |
160 | 160 |
161 // Used to show confirmation UI for uninstalling extensions in incognito mode. | 161 // Used to show confirmation UI for uninstalling extensions in incognito mode. |
162 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 162 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
(...skipping 11 matching lines...) Expand all Loading... |
174 // refreshing. This is useful when making many batch updates to avoid flicker. | 174 // refreshing. This is useful when making many batch updates to avoid flicker. |
175 bool ignore_changes_; | 175 bool ignore_changes_; |
176 | 176 |
177 // Hold state for favicon requests. | 177 // Hold state for favicon requests. |
178 CancelableRequestConsumerTSimple<WebApplicationInfo*> favicon_consumer_; | 178 CancelableRequestConsumerTSimple<WebApplicationInfo*> favicon_consumer_; |
179 | 179 |
180 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); | 180 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); |
181 }; | 181 }; |
182 | 182 |
183 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ | 183 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ |
OLD | NEW |