| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ | 5 #ifndef UI_GFX_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ |
| 6 #define UI_GFX_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ | 6 #define UI_GFX_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "mojo/public/cpp/bindings/struct_traits.h" | 12 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 13 #include "ui/gfx/icc_profile.h" | 13 #include "ui/gfx/icc_profile.h" |
| 14 #include "ui/gfx/ipc/color/gfx_param_traits.h" |
| 14 #include "ui/gfx/mojo/icc_profile.mojom.h" | 15 #include "ui/gfx/mojo/icc_profile.mojom.h" |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 | 18 |
| 18 template <> | 19 template <> |
| 19 struct StructTraits<gfx::mojom::ICCProfileDataView, gfx::ICCProfile> { | 20 struct StructTraits<gfx::mojom::ICCProfileDataView, gfx::ICCProfile> { |
| 20 static bool valid(const gfx::ICCProfile& profile) { return profile.valid_; } | 21 static gfx::ICCProfile::Type type(const gfx::ICCProfile& profile) { |
| 22 return profile.type_; |
| 23 } |
| 24 static gfx::ColorSpace color_space(const gfx::ICCProfile& profile) { |
| 25 return profile.color_space_; |
| 26 } |
| 21 static base::StringPiece data(const gfx::ICCProfile& profile) { | 27 static base::StringPiece data(const gfx::ICCProfile& profile) { |
| 22 return base::StringPiece(profile.data_.data(), profile.data_.size()); | 28 return base::StringPiece(profile.data_.data(), profile.data_.size()); |
| 23 } | 29 } |
| 24 static uint64_t id(const gfx::ICCProfile& profile) { return profile.id_; } | 30 static uint64_t id(const gfx::ICCProfile& profile) { return profile.id_; } |
| 25 | 31 |
| 26 static bool Read(gfx::mojom::ICCProfileDataView data, | 32 static bool Read(gfx::mojom::ICCProfileDataView data, |
| 27 gfx::ICCProfile* profile); | 33 gfx::ICCProfile* profile); |
| 28 }; | 34 }; |
| 29 | 35 |
| 30 } // namespace mojo | 36 } // namespace mojo |
| 31 | 37 |
| 32 #endif // UI_GFX_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ | 38 #endif // UI_GFX_MOJO_ICC_PROFILE_STRUCT_TRAITS_H_ |
| OLD | NEW |