OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BOOKMARK_APP_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/common/web_application_info.h" | 15 #include "chrome/common/web_application_info.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 | 18 |
19 class ExtensionService; | 19 class ExtensionService; |
20 class FaviconDownloader; | 20 class FaviconDownloader; |
21 class SkBitmap; | 21 class SkBitmap; |
22 | 22 |
23 namespace content { | 23 namespace content { |
| 24 class BrowserContext; |
24 class WebContents; | 25 class WebContents; |
25 } | 26 } |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
28 class CrxInstaller; | 29 class CrxInstaller; |
29 class Extension; | 30 class Extension; |
30 | 31 |
31 // A helper class for creating bookmark apps from a WebContents. | 32 // A helper class for creating bookmark apps from a WebContents. |
32 class BookmarkAppHelper : public content::NotificationObserver { | 33 class BookmarkAppHelper : public content::NotificationObserver { |
33 public: | 34 public: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 scoped_refptr<extensions::CrxInstaller> crx_installer_; | 87 scoped_refptr<extensions::CrxInstaller> crx_installer_; |
87 | 88 |
88 content::NotificationRegistrar registrar_; | 89 content::NotificationRegistrar registrar_; |
89 }; | 90 }; |
90 | 91 |
91 // Creates or updates a bookmark app from the given |web_app_info|. Icons will | 92 // Creates or updates a bookmark app from the given |web_app_info|. Icons will |
92 // not be downloaded so only supplied icon data will be used. | 93 // not be downloaded so only supplied icon data will be used. |
93 void CreateOrUpdateBookmarkApp(ExtensionService* service, | 94 void CreateOrUpdateBookmarkApp(ExtensionService* service, |
94 WebApplicationInfo& web_app_info); | 95 WebApplicationInfo& web_app_info); |
95 | 96 |
| 97 // Retrieves the WebApplicationInfo that represents a given bookmark app. |
| 98 // |callback| will be called with a WebApplicationInfo which is populated with |
| 99 // the extension's details and icons on success and an unpopulated |
| 100 // WebApplicationInfo on failure. |
| 101 void GetWebApplicationInfoFromApp( |
| 102 content::BrowserContext* browser_context, |
| 103 const extensions::Extension* extension, |
| 104 const base::Callback<void(const WebApplicationInfo&)> callback); |
| 105 |
96 // Returns whether the given |url| is a valid bookmark app url. | 106 // Returns whether the given |url| is a valid bookmark app url. |
97 bool IsValidBookmarkAppUrl(const GURL& url); | 107 bool IsValidBookmarkAppUrl(const GURL& url); |
98 | 108 |
99 } // namespace extensions | 109 } // namespace extensions |
100 | 110 |
101 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 111 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
OLD | NEW |