| 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" | |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 12 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 14 #include "chrome/common/web_application_info.h" | |
| 15 #include "components/favicon_base/favicon_types.h" | |
| 16 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 19 #include "extensions/browser/browser_context_keyed_api_factory.h" | 15 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 20 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
| 21 | 17 |
| 22 class ExtensionService; | 18 class ExtensionService; |
| 23 class ExtensionUninstallDialog; | 19 class ExtensionUninstallDialog; |
| 24 | 20 |
| 25 namespace extensions { | 21 namespace extensions { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 public: | 193 public: |
| 198 DECLARE_EXTENSION_FUNCTION("management.setLaunchType", | 194 DECLARE_EXTENSION_FUNCTION("management.setLaunchType", |
| 199 MANAGEMENT_SETLAUNCHTYPE); | 195 MANAGEMENT_SETLAUNCHTYPE); |
| 200 | 196 |
| 201 protected: | 197 protected: |
| 202 virtual ~ManagementSetLaunchTypeFunction() {} | 198 virtual ~ManagementSetLaunchTypeFunction() {} |
| 203 | 199 |
| 204 virtual bool RunSync() OVERRIDE; | 200 virtual bool RunSync() OVERRIDE; |
| 205 }; | 201 }; |
| 206 | 202 |
| 207 class ManagementGenerateAppForLinkFunction : public AsyncManagementFunction { | |
| 208 public: | |
| 209 DECLARE_EXTENSION_FUNCTION("management.generateAppForLink", | |
| 210 MANAGEMENT_GENERATEAPPFORLINK); | |
| 211 | |
| 212 ManagementGenerateAppForLinkFunction(); | |
| 213 | |
| 214 protected: | |
| 215 virtual ~ManagementGenerateAppForLinkFunction(); | |
| 216 | |
| 217 virtual bool RunAsync() OVERRIDE; | |
| 218 | |
| 219 private: | |
| 220 void OnFaviconForApp(const favicon_base::FaviconImageResult& image_result); | |
| 221 void FinishCreateBookmarkApp(const extensions::Extension* extension, | |
| 222 const WebApplicationInfo& web_app_info); | |
| 223 | |
| 224 std::string title_; | |
| 225 GURL launch_url_; | |
| 226 | |
| 227 scoped_ptr<BookmarkAppHelper> bookmark_app_helper_; | |
| 228 | |
| 229 // Used for favicon loading tasks. | |
| 230 base::CancelableTaskTracker cancelable_task_tracker_; | |
| 231 }; | |
| 232 | |
| 233 class ManagementEventRouter : public content::NotificationObserver { | 203 class ManagementEventRouter : public content::NotificationObserver { |
| 234 public: | 204 public: |
| 235 explicit ManagementEventRouter(Profile* profile); | 205 explicit ManagementEventRouter(Profile* profile); |
| 236 virtual ~ManagementEventRouter(); | 206 virtual ~ManagementEventRouter(); |
| 237 | 207 |
| 238 private: | 208 private: |
| 239 // content::NotificationObserver implementation. | 209 // content::NotificationObserver implementation. |
| 240 virtual void Observe(int type, | 210 virtual void Observe(int type, |
| 241 const content::NotificationSource& source, | 211 const content::NotificationSource& source, |
| 242 const content::NotificationDetails& details) OVERRIDE; | 212 const content::NotificationDetails& details) OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 247 |
| 278 // Created lazily upon OnListenerAdded. | 248 // Created lazily upon OnListenerAdded. |
| 279 scoped_ptr<ManagementEventRouter> management_event_router_; | 249 scoped_ptr<ManagementEventRouter> management_event_router_; |
| 280 | 250 |
| 281 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); | 251 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); |
| 282 }; | 252 }; |
| 283 | 253 |
| 284 } // namespace extensions | 254 } // namespace extensions |
| 285 | 255 |
| 286 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 256 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
| OLD | NEW |