Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/extensions/api/management/management_api.h

Issue 266353006: Add generateAppForLink function in chrome.management (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/web_application_info.h"
15 #include "components/favicon_base/favicon_types.h"
12 #include "components/keyed_service/core/keyed_service.h" 16 #include "components/keyed_service/core/keyed_service.h"
13 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
15 #include "extensions/browser/browser_context_keyed_api_factory.h" 19 #include "extensions/browser/browser_context_keyed_api_factory.h"
16 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
17 21
18 class ExtensionService; 22 class ExtensionService;
19 class ExtensionUninstallDialog; 23 class ExtensionUninstallDialog;
20 24
21 namespace extensions { 25 namespace extensions {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 public: 197 public:
194 DECLARE_EXTENSION_FUNCTION("management.setLaunchType", 198 DECLARE_EXTENSION_FUNCTION("management.setLaunchType",
195 MANAGEMENT_SETLAUNCHTYPE); 199 MANAGEMENT_SETLAUNCHTYPE);
196 200
197 protected: 201 protected:
198 virtual ~ManagementSetLaunchTypeFunction() {} 202 virtual ~ManagementSetLaunchTypeFunction() {}
199 203
200 virtual bool RunSync() OVERRIDE; 204 virtual bool RunSync() OVERRIDE;
201 }; 205 };
202 206
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
203 class ManagementEventRouter : public content::NotificationObserver { 233 class ManagementEventRouter : public content::NotificationObserver {
204 public: 234 public:
205 explicit ManagementEventRouter(Profile* profile); 235 explicit ManagementEventRouter(Profile* profile);
206 virtual ~ManagementEventRouter(); 236 virtual ~ManagementEventRouter();
207 237
208 private: 238 private:
209 // content::NotificationObserver implementation. 239 // content::NotificationObserver implementation.
210 virtual void Observe(int type, 240 virtual void Observe(int type,
211 const content::NotificationSource& source, 241 const content::NotificationSource& source,
212 const content::NotificationDetails& details) OVERRIDE; 242 const content::NotificationDetails& details) OVERRIDE;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 277
248 // Created lazily upon OnListenerAdded. 278 // Created lazily upon OnListenerAdded.
249 scoped_ptr<ManagementEventRouter> management_event_router_; 279 scoped_ptr<ManagementEventRouter> management_event_router_;
250 280
251 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); 281 DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
252 }; 282 };
253 283
254 } // namespace extensions 284 } // namespace extensions
255 285
256 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ 286 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698