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

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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 void OnFaviconForApp(const favicon_base::FaviconImageResult& image_result);
210
211 void FinishCreateBookmarkApp(const extensions::Extension* extension,
212 const WebApplicationInfo& web_app_info);
213
214 std::string title_;
215
216 GURL launch_url_;
benwells 2014/05/28 01:04:18 Nit: no need for the blank line between these two.
wjywbs 2014/05/28 01:19:01 Done.
217
218 scoped_ptr<BookmarkAppHelper> bookmark_app_helper_;
219
220 // Used for favicon loading tasks.
221 base::CancelableTaskTracker cancelable_task_tracker_;
222 };
223
192 class ManagementEventRouter : public content::NotificationObserver { 224 class ManagementEventRouter : public content::NotificationObserver {
193 public: 225 public:
194 explicit ManagementEventRouter(Profile* profile); 226 explicit ManagementEventRouter(Profile* profile);
195 virtual ~ManagementEventRouter(); 227 virtual ~ManagementEventRouter();
196 228
197 private: 229 private:
198 // content::NotificationObserver implementation. 230 // content::NotificationObserver implementation.
199 virtual void Observe(int type, 231 virtual void Observe(int type,
200 const content::NotificationSource& source, 232 const content::NotificationSource& source,
201 const content::NotificationDetails& details) OVERRIDE; 233 const content::NotificationDetails& details) OVERRIDE;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 268
237 // Created lazily upon OnListenerAdded. 269 // Created lazily upon OnListenerAdded.
238 scoped_ptr<ManagementEventRouter> management_event_router_; 270 scoped_ptr<ManagementEventRouter> management_event_router_;
239 271
240 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); 272 DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
241 }; 273 };
242 274
243 } // namespace extensions 275 } // namespace extensions
244 276
245 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ 277 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698