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_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/task/cancelable_task_tracker.h" | |
10 #include "chrome/browser/extensions/bookmark_app_helper.h" | |
9 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
14 #include "components/favicon_base/favicon_types.h" | |
12 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
13 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
15 #include "extensions/browser/browser_context_keyed_api_factory.h" | 18 #include "extensions/browser/browser_context_keyed_api_factory.h" |
16 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
17 | 20 |
18 class ExtensionService; | 21 class ExtensionService; |
19 class ExtensionUninstallDialog; | 22 class ExtensionUninstallDialog; |
23 class WebApplicationInfo; | |
20 | 24 |
21 namespace extensions { | 25 namespace extensions { |
22 | 26 |
23 class ManagementFunction : public ChromeSyncExtensionFunction { | 27 class ManagementFunction : public ChromeSyncExtensionFunction { |
24 protected: | 28 protected: |
25 virtual ~ManagementFunction() {} | 29 virtual ~ManagementFunction() {} |
26 | 30 |
27 ExtensionService* service(); | 31 ExtensionService* service(); |
28 }; | 32 }; |
29 | 33 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 void OnCloseShortcutPrompt(bool created); | 186 void OnCloseShortcutPrompt(bool created); |
183 | 187 |
184 static void SetAutoConfirmForTest(bool should_proceed); | 188 static void SetAutoConfirmForTest(bool should_proceed); |
185 | 189 |
186 protected: | 190 protected: |
187 virtual ~ManagementCreateAppShortcutFunction(); | 191 virtual ~ManagementCreateAppShortcutFunction(); |
188 | 192 |
189 virtual bool RunAsync() OVERRIDE; | 193 virtual bool RunAsync() OVERRIDE; |
190 }; | 194 }; |
191 | 195 |
196 class ManagementGenerateAppForLinkFunction : public AsyncManagementFunction { | |
197 public: | |
198 DECLARE_EXTENSION_FUNCTION("management.generateAppForLink", | |
199 MANAGEMENT_GENERATEAPPFORLINK); | |
200 | |
201 ManagementGenerateAppForLinkFunction(); | |
202 | |
203 protected: | |
204 virtual ~ManagementGenerateAppForLinkFunction(); | |
205 | |
206 virtual bool RunAsync() OVERRIDE; | |
207 | |
208 private: | |
209 struct AppInstallInfo { | |
benwells
2014/05/27 22:05:54
Why do you need this struct? Seems like having a t
wjywbs
2014/05/27 22:20:21
Done.
| |
210 AppInstallInfo() {} | |
211 ~AppInstallInfo() {} | |
212 | |
213 std::string title; | |
214 GURL launch_url; | |
215 }; | |
216 | |
217 void OnFaviconForApp(const favicon_base::FaviconImageResult& image_result); | |
218 | |
219 void FinishCreateBookmarkApp(const extensions::Extension* extension, | |
220 const WebApplicationInfo& web_app_info); | |
221 | |
222 scoped_ptr<AppInstallInfo> install_info_; | |
223 | |
224 scoped_ptr<BookmarkAppHelper> bookmark_app_helper_; | |
225 | |
226 // Used for favicon loading tasks. | |
227 base::CancelableTaskTracker cancelable_task_tracker_; | |
228 }; | |
229 | |
192 class ManagementEventRouter : public content::NotificationObserver { | 230 class ManagementEventRouter : public content::NotificationObserver { |
193 public: | 231 public: |
194 explicit ManagementEventRouter(Profile* profile); | 232 explicit ManagementEventRouter(Profile* profile); |
195 virtual ~ManagementEventRouter(); | 233 virtual ~ManagementEventRouter(); |
196 | 234 |
197 private: | 235 private: |
198 // content::NotificationObserver implementation. | 236 // content::NotificationObserver implementation. |
199 virtual void Observe(int type, | 237 virtual void Observe(int type, |
200 const content::NotificationSource& source, | 238 const content::NotificationSource& source, |
201 const content::NotificationDetails& details) OVERRIDE; | 239 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 | 274 |
237 // Created lazily upon OnListenerAdded. | 275 // Created lazily upon OnListenerAdded. |
238 scoped_ptr<ManagementEventRouter> management_event_router_; | 276 scoped_ptr<ManagementEventRouter> management_event_router_; |
239 | 277 |
240 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); | 278 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); |
241 }; | 279 }; |
242 | 280 |
243 } // namespace extensions | 281 } // namespace extensions |
244 | 282 |
245 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 283 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
OLD | NEW |