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

Side by Side Diff: ui/gfx/image/image_family.h

Issue 64853004: Use high resolution icons where possible for streamlined hosted app icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_experiment_create_app_from_page
Patch Set: rework, add tests Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 UI_GFX_IMAGE_IMAGE_FAMILY_H_ 5 #ifndef UI_GFX_IMAGE_IMAGE_FAMILY_H_
6 #define UI_GFX_IMAGE_IMAGE_FAMILY_H_ 6 #define UI_GFX_IMAGE_IMAGE_FAMILY_H_
7 7
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ~ImageFamily(); 99 ~ImageFamily();
100 100
101 // Gets an iterator to the first image. 101 // Gets an iterator to the first image.
102 const_iterator begin() const { return const_iterator(map_.begin()); } 102 const_iterator begin() const { return const_iterator(map_.begin()); }
103 // Gets an iterator to one after the last image. 103 // Gets an iterator to one after the last image.
104 const_iterator end() const { return const_iterator(map_.end()); } 104 const_iterator end() const { return const_iterator(map_.end()); }
105 105
106 // Determines whether the image family has no images in it. 106 // Determines whether the image family has no images in it.
107 bool empty() const { return map_.empty(); } 107 bool empty() const { return map_.empty(); }
108 108
109 // Returns the number of images in the family.
110 size_t size() const { return map_.size(); }
111
109 // Removes all images from the family. 112 // Removes all images from the family.
110 void clear() { return map_.clear(); } 113 void clear() { return map_.clear(); }
111 114
112 // Adds an image to the family. If another image is already present at the 115 // Adds an image to the family. If another image is already present at the
113 // same size, it will be overwritten. 116 // same size, it will be overwritten.
114 void Add(const gfx::Image& image); 117 void Add(const gfx::Image& image);
115 118
116 // Adds an image to the family. If another image is already present at the 119 // Adds an image to the family. If another image is already present at the
117 // same size, it will be overwritten. 120 // same size, it will be overwritten.
118 void Add(const gfx::ImageSkia& image_skia); 121 void Add(const gfx::ImageSkia& image_skia);
(...skipping 28 matching lines...) Expand all
147 // |map_| of aspect ratio |aspect|. 150 // |map_| of aspect ratio |aspect|.
148 const gfx::Image* GetWithExactAspect(float aspect, int width) const; 151 const gfx::Image* GetWithExactAspect(float aspect, int width) const;
149 152
150 // Map from (aspect ratio, width) to image. 153 // Map from (aspect ratio, width) to image.
151 std::map<MapKey, gfx::Image> map_; 154 std::map<MapKey, gfx::Image> map_;
152 }; 155 };
153 156
154 } // namespace gfx 157 } // namespace gfx
155 158
156 #endif // UI_GFX_IMAGE_IMAGE_FAMILY_H_ 159 #endif // UI_GFX_IMAGE_IMAGE_FAMILY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698