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 UI_DISPLAY_TYPES_DISPLAY_MODE_H_ | 5 #ifndef UI_DISPLAY_TYPES_DISPLAY_MODE_H_ |
6 #define UI_DISPLAY_TYPES_DISPLAY_MODE_H_ | 6 #define UI_DISPLAY_TYPES_DISPLAY_MODE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "mojo/public/cpp/bindings/struct_traits.h" | |
13 #include "ui/display/types/display_types_export.h" | 14 #include "ui/display/types/display_types_export.h" |
14 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
15 | 16 |
16 namespace display { | 17 namespace display { |
17 | 18 |
19 namespace mojom { | |
20 class DisplayModeDataView; | |
21 } // namespace mojom | |
22 | |
18 // This class represents the basic information for a native mode. Platforms will | 23 // This class represents the basic information for a native mode. Platforms will |
19 // extend this class to add platform specific information about the mode. | 24 // extend this class to add platform specific information about the mode. |
20 class DISPLAY_TYPES_EXPORT DisplayMode { | 25 class DISPLAY_TYPES_EXPORT DisplayMode { |
21 public: | 26 public: |
27 DisplayMode(); | |
22 DisplayMode(const gfx::Size& size, bool interlaced, float refresh_rate); | 28 DisplayMode(const gfx::Size& size, bool interlaced, float refresh_rate); |
29 DisplayMode(DisplayMode&&); | |
rjkroege
2017/01/27 18:54:55
needs explicit.
Also: without std::move(<display
thanhph1
2017/01/27 21:12:23
Acknowledged. I removed this line.
| |
30 DisplayMode& operator=(DisplayMode&&); | |
rjkroege
2017/01/27 18:54:55
Do we need this? Can we remove?
thanhph1
2017/01/27 21:12:23
Done.
| |
31 | |
23 virtual ~DisplayMode(); | 32 virtual ~DisplayMode(); |
24 virtual std::unique_ptr<DisplayMode> Clone() const; | 33 virtual std::unique_ptr<DisplayMode> Clone() const; |
25 | 34 |
26 const gfx::Size& size() const { return size_; } | 35 const gfx::Size& size() const { return size_; } |
27 bool is_interlaced() const { return is_interlaced_; } | 36 bool is_interlaced() const { return is_interlaced_; } |
28 float refresh_rate() const { return refresh_rate_; } | 37 float refresh_rate() const { return refresh_rate_; } |
29 | 38 |
30 virtual std::string ToString() const; | 39 virtual std::string ToString() const; |
31 | 40 |
32 private: | 41 private: |
42 friend struct mojo::StructTraits<mojom::DisplayModeDataView, DisplayMode>; | |
43 | |
33 gfx::Size size_; | 44 gfx::Size size_; |
rjkroege
2017/01/27 18:54:55
I don't like seeing the same structure defined in
kylechar
2017/01/27 19:34:18
Having to update a C++ class, mojom and StructTrai
thanhph1
2017/01/27 21:12:23
I chat to Kyle and removed changes in display_mode
| |
34 bool is_interlaced_; | 45 bool is_interlaced_; |
35 float refresh_rate_; | 46 float refresh_rate_; |
36 | 47 |
37 DISALLOW_COPY_AND_ASSIGN(DisplayMode); | 48 DISALLOW_COPY_AND_ASSIGN(DisplayMode); |
38 }; | 49 }; |
39 | 50 |
40 // Used to by gtest to print readable errors. | 51 // Used to by gtest to print readable errors. |
41 DISPLAY_TYPES_EXPORT void PrintTo(const DisplayMode& mode, std::ostream* os); | 52 DISPLAY_TYPES_EXPORT void PrintTo(const DisplayMode& mode, std::ostream* os); |
42 | 53 |
43 } // namespace display | 54 } // namespace display |
44 | 55 |
45 #endif // UI_DISPLAY_TYPES_DISPLAY_MODE_H_ | 56 #endif // UI_DISPLAY_TYPES_DISPLAY_MODE_H_ |
OLD | NEW |