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> |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Extension; | 30 class Extension; |
31 | 31 |
32 // A helper class for creating bookmark apps from a WebContents. | 32 // A helper class for creating bookmark apps from a WebContents. |
33 class BookmarkAppHelper : public content::NotificationObserver { | 33 class BookmarkAppHelper : public content::NotificationObserver { |
34 public: | 34 public: |
35 typedef base::Callback<void(const Extension*, const WebApplicationInfo&)> | 35 typedef base::Callback<void(const Extension*, const WebApplicationInfo&)> |
36 CreateBookmarkAppCallback; | 36 CreateBookmarkAppCallback; |
37 | 37 |
38 // This helper class will create a bookmark app out of |web_app_info| and | 38 // This helper class will create a bookmark app out of |web_app_info| and |
39 // install it to |service|. Icons will be downloaded from the URLs in | 39 // install it to |service|. Icons will be downloaded from the URLs in |
40 // |web_app_info.icons| using |contents|. | 40 // |web_app_info.icons| using |contents| if |contents| is not NULL. |
| 41 // All existing icons from WebApplicationInfo will also be used. |
41 BookmarkAppHelper(ExtensionService* service, | 42 BookmarkAppHelper(ExtensionService* service, |
42 WebApplicationInfo web_app_info, | 43 WebApplicationInfo web_app_info, |
43 content::WebContents* contents); | 44 content::WebContents* contents); |
44 virtual ~BookmarkAppHelper(); | 45 virtual ~BookmarkAppHelper(); |
45 | 46 |
46 // This finds the closest not-smaller bitmap in |bitmaps| for each size in | 47 // This finds the closest not-smaller bitmap in |bitmaps| for each size in |
47 // |sizes| and resizes it to that size. This returns a map of sizes to bitmaps | 48 // |sizes| and resizes it to that size. This returns a map of sizes to bitmaps |
48 // which contains only bitmaps of a size in |sizes| and at most one bitmap of | 49 // which contains only bitmaps of a size in |sizes| and at most one bitmap of |
49 // each size. | 50 // each size. |
50 static std::map<int, SkBitmap> ConstrainBitmapsToSizes( | 51 static std::map<int, SkBitmap> ConstrainBitmapsToSizes( |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 content::BrowserContext* browser_context, | 104 content::BrowserContext* browser_context, |
104 const extensions::Extension* extension, | 105 const extensions::Extension* extension, |
105 const base::Callback<void(const WebApplicationInfo&)> callback); | 106 const base::Callback<void(const WebApplicationInfo&)> callback); |
106 | 107 |
107 // Returns whether the given |url| is a valid bookmark app url. | 108 // Returns whether the given |url| is a valid bookmark app url. |
108 bool IsValidBookmarkAppUrl(const GURL& url); | 109 bool IsValidBookmarkAppUrl(const GURL& url); |
109 | 110 |
110 } // namespace extensions | 111 } // namespace extensions |
111 | 112 |
112 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 113 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
OLD | NEW |