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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.h

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
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 24 matching lines...) Expand all
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| if |contents| is not NULL.
41 // All existing icons from WebApplicationInfo will also be used. 41 // All existing icons from WebApplicationInfo will also be used.
42 BookmarkAppHelper(ExtensionService* service, 42 BookmarkAppHelper(ExtensionService* service,
43 WebApplicationInfo web_app_info, 43 WebApplicationInfo web_app_info,
44 content::WebContents* contents); 44 content::WebContents* contents);
45 virtual ~BookmarkAppHelper(); 45 ~BookmarkAppHelper() override;
46 46
47 // 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
48 // |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
49 // 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
50 // each size. 50 // each size.
51 static std::map<int, SkBitmap> ConstrainBitmapsToSizes( 51 static std::map<int, SkBitmap> ConstrainBitmapsToSizes(
52 const std::vector<SkBitmap>& bitmaps, 52 const std::vector<SkBitmap>& bitmaps,
53 const std::set<int>& sizes); 53 const std::set<int>& sizes);
54 54
55 // Adds a square container icon of |output_size| pixels to |bitmaps| by 55 // Adds a square container icon of |output_size| pixels to |bitmaps| by
56 // drawing the given |letter| into a rounded background of |color|. 56 // drawing the given |letter| into a rounded background of |color|.
57 // Does nothing if an icon of |output_size| already exists in |bitmaps|. 57 // Does nothing if an icon of |output_size| already exists in |bitmaps|.
58 static void GenerateIcon(std::map<int, SkBitmap>* bitmaps, 58 static void GenerateIcon(std::map<int, SkBitmap>* bitmaps,
59 int output_size, 59 int output_size,
60 SkColor color, 60 SkColor color,
61 char letter); 61 char letter);
62 62
63 // Begins the asynchronous bookmark app creation. 63 // Begins the asynchronous bookmark app creation.
64 void Create(const CreateBookmarkAppCallback& callback); 64 void Create(const CreateBookmarkAppCallback& callback);
65 65
66 private: 66 private:
67 friend class TestBookmarkAppHelper; 67 friend class TestBookmarkAppHelper;
68 68
69 // Performs post icon download tasks including installing the bookmark app. 69 // Performs post icon download tasks including installing the bookmark app.
70 void OnIconsDownloaded(bool success, 70 void OnIconsDownloaded(bool success,
71 const std::map<GURL, std::vector<SkBitmap> >& bitmaps); 71 const std::map<GURL, std::vector<SkBitmap> >& bitmaps);
72 72
73 // Overridden from content::NotificationObserver: 73 // Overridden from content::NotificationObserver:
74 virtual void Observe(int type, 74 void Observe(int type,
75 const content::NotificationSource& source, 75 const content::NotificationSource& source,
76 const content::NotificationDetails& details) override; 76 const content::NotificationDetails& details) override;
77 77
78 // The WebApplicationInfo that the bookmark app is being created for. 78 // The WebApplicationInfo that the bookmark app is being created for.
79 WebApplicationInfo web_app_info_; 79 WebApplicationInfo web_app_info_;
80 80
81 // Called on app creation or failure. 81 // Called on app creation or failure.
82 CreateBookmarkAppCallback callback_; 82 CreateBookmarkAppCallback callback_;
83 83
84 // Downloads icons from the given WebApplicationInfo using the given 84 // Downloads icons from the given WebApplicationInfo using the given
85 // WebContents. 85 // WebContents.
86 scoped_ptr<FaviconDownloader> favicon_downloader_; 86 scoped_ptr<FaviconDownloader> favicon_downloader_;
(...skipping 17 matching lines...) Expand all
104 content::BrowserContext* browser_context, 104 content::BrowserContext* browser_context,
105 const extensions::Extension* extension, 105 const extensions::Extension* extension,
106 const base::Callback<void(const WebApplicationInfo&)> callback); 106 const base::Callback<void(const WebApplicationInfo&)> callback);
107 107
108 // Returns whether the given |url| is a valid bookmark app url. 108 // Returns whether the given |url| is a valid bookmark app url.
109 bool IsValidBookmarkAppUrl(const GURL& url); 109 bool IsValidBookmarkAppUrl(const GURL& url);
110 110
111 } // namespace extensions 111 } // namespace extensions
112 112
113 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ 113 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blob_reader.h ('k') | chrome/browser/extensions/bookmark_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698