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

Side by Side Diff: ui/gfx/size_base.h

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SIZE_BASE_H_ 5 #ifndef UI_GFX_SIZE_BASE_H_
6 #define UI_GFX_SIZE_BASE_H_ 6 #define UI_GFX_SIZE_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void set_height(Type height); 44 void set_height(Type height);
45 45
46 bool operator==(const Class& s) const { 46 bool operator==(const Class& s) const {
47 return width_ == s.width_ && height_ == s.height_; 47 return width_ == s.width_ && height_ == s.height_;
48 } 48 }
49 49
50 bool operator!=(const Class& s) const { 50 bool operator!=(const Class& s) const {
51 return !(*this == s); 51 return !(*this == s);
52 } 52 }
53 53
54 // A size is less than another size if its width is less than the |other|
55 // size's width. If the widths are equal, then the size with the smallest
56 // height is less than the other. The comparison is required to uses Sizes in
57 // sets and sorted vectors.
58 bool operator<(const Class& other) const {
59 return (width_ == other.width_) ?
60 height_ < other.height_ : width_ < other.width_;
61 }
62
54 bool IsEmpty() const { 63 bool IsEmpty() const {
55 // Size doesn't allow negative dimensions, so testing for 0 is enough. 64 // Size doesn't allow negative dimensions, so testing for 0 is enough.
56 return (width_ == 0) || (height_ == 0); 65 return (width_ == 0) || (height_ == 0);
57 } 66 }
58 67
59 protected: 68 protected:
60 SizeBase(Type width, Type height); 69 SizeBase(Type width, Type height);
61 // Destructor is intentionally made non virtual and protected. 70 // Destructor is intentionally made non virtual and protected.
62 // Do not make this public. 71 // Do not make this public.
63 ~SizeBase(); 72 ~SizeBase();
64 73
65 private: 74 private:
66 Type width_; 75 Type width_;
67 Type height_; 76 Type height_;
68 }; 77 };
69 78
70 } // namespace gfx 79 } // namespace gfx
71 80
72 #endif // UI_GFX_SIZE_BASE_H_ 81 #endif // UI_GFX_SIZE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698