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

Side by Side Diff: ui/display/types/display_mode.h

Issue 2636073002: Create mojom and StructTraits for ui/display/types/display_mode.cc (Closed)
Patch Set: Change structure not to use display_mode_mojo.(cc|h). Instead, use friend class in display_mode.h. Created 3 years, 10 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 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 "ui/display/types/display_types_export.h" 13 #include "ui/display/types/display_types_export.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 15
16 #if !defined(OS_IOS)
kylechar 2017/01/25 16:59:45 Get rid of all the !defined(OS_IOS) ifdefs, here a
thanhph1 2017/01/25 20:28:40 Done.
17 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck
kylechar 2017/01/25 16:59:45 Remove the // nogncheck.
thanhph1 2017/01/25 20:28:40 Done.
18 #endif
19
16 namespace display { 20 namespace display {
17 21
22 #if !defined(OS_IOS)
23 namespace mojom {
24 class DisplayModeDataView;
25 }
26 #endif
27
18 // This class represents the basic information for a native mode. Platforms will 28 // This class represents the basic information for a native mode. Platforms will
19 // extend this class to add platform specific information about the mode. 29 // extend this class to add platform specific information about the mode.
20 class DISPLAY_TYPES_EXPORT DisplayMode { 30 class DISPLAY_TYPES_EXPORT DisplayMode {
21 public: 31 public:
32 DisplayMode();
kylechar 2017/01/25 16:59:45 Can you make this private? I'm not sure what insta
thanhph1 2017/01/25 20:28:40 This display_struct_traits_test.mojom.cc uses it s
22 DisplayMode(const gfx::Size& size, bool interlaced, float refresh_rate); 33 DisplayMode(const gfx::Size& size, bool interlaced, float refresh_rate);
34 DisplayMode(DisplayMode&&);
35 DisplayMode& operator=(DisplayMode&&);
36
23 virtual ~DisplayMode(); 37 virtual ~DisplayMode();
24 virtual std::unique_ptr<DisplayMode> Clone() const; 38 virtual std::unique_ptr<DisplayMode> Clone() const;
25 39
26 const gfx::Size& size() const { return size_; } 40 const gfx::Size& size() const { return size_; }
27 bool is_interlaced() const { return is_interlaced_; } 41 bool is_interlaced() const { return is_interlaced_; }
28 float refresh_rate() const { return refresh_rate_; } 42 float refresh_rate() const { return refresh_rate_; }
29 43
30 virtual std::string ToString() const; 44 virtual std::string ToString() const;
31 45
32 private: 46 private:
33 gfx::Size size_; 47 gfx::Size size_;
34 bool is_interlaced_; 48 bool is_interlaced_;
35 float refresh_rate_; 49 float refresh_rate_;
36 50
51 #if !defined(OS_IOS)
52 friend struct mojo::StructTraits<mojom::DisplayModeDataView, DisplayMode>;
53 #endif
54
37 DISALLOW_COPY_AND_ASSIGN(DisplayMode); 55 DISALLOW_COPY_AND_ASSIGN(DisplayMode);
38 }; 56 };
39 57
40 // Used to by gtest to print readable errors. 58 // Used to by gtest to print readable errors.
41 DISPLAY_TYPES_EXPORT void PrintTo(const DisplayMode& mode, std::ostream* os); 59 DISPLAY_TYPES_EXPORT void PrintTo(const DisplayMode& mode, std::ostream* os);
42 60
43 } // namespace display 61 } // namespace display
44 62
45 #endif // UI_DISPLAY_TYPES_DISPLAY_MODE_H_ 63 #endif // UI_DISPLAY_TYPES_DISPLAY_MODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698