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