| 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 COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAITS_H | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAITS_H |
| 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAITS_H | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAITS_H |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/values.h" |
| 10 #include "components/content_settings/core/common/content_settings.h" | 12 #include "components/content_settings/core/common/content_settings.h" |
| 11 #include "components/content_settings/core/common/content_settings.mojom.h" | 13 #include "components/content_settings/core/common/content_settings.mojom.h" |
| 14 #include "mojo/common/values_struct_traits.h" |
| 12 #include "mojo/public/cpp/bindings/enum_traits.h" | 15 #include "mojo/public/cpp/bindings/enum_traits.h" |
| 13 #include "mojo/public/cpp/bindings/struct_traits.h" | 16 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 14 | 17 |
| 15 namespace mojo { | 18 namespace mojo { |
| 16 | 19 |
| 17 template <> | 20 template <> |
| 18 struct StructTraits<content_settings::mojom::PatternPartsDataView, | 21 struct StructTraits<content_settings::mojom::PatternPartsDataView, |
| 19 ContentSettingsPattern::PatternParts> { | 22 ContentSettingsPattern::PatternParts> { |
| 20 static const std::string& scheme( | 23 static const std::string& scheme( |
| 21 const ContentSettingsPattern::PatternParts& r) { | 24 const ContentSettingsPattern::PatternParts& r) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 static const ContentSettingsPattern& primary_pattern( | 92 static const ContentSettingsPattern& primary_pattern( |
| 90 const ContentSettingPatternSource& r) { | 93 const ContentSettingPatternSource& r) { |
| 91 return r.primary_pattern; | 94 return r.primary_pattern; |
| 92 } | 95 } |
| 93 | 96 |
| 94 static const ContentSettingsPattern& secondary_pattern( | 97 static const ContentSettingsPattern& secondary_pattern( |
| 95 const ContentSettingPatternSource& r) { | 98 const ContentSettingPatternSource& r) { |
| 96 return r.secondary_pattern; | 99 return r.secondary_pattern; |
| 97 } | 100 } |
| 98 | 101 |
| 99 static ContentSetting setting(const ContentSettingPatternSource& r) { | 102 static const std::unique_ptr<base::Value>& setting_value( |
| 100 return r.setting; | 103 const ContentSettingPatternSource& r) { |
| 104 return r.setting_value; |
| 101 } | 105 } |
| 102 | 106 |
| 103 static const std::string& source(const ContentSettingPatternSource& r) { | 107 static const std::string& source(const ContentSettingPatternSource& r) { |
| 104 return r.source; | 108 return r.source; |
| 105 } | 109 } |
| 106 | 110 |
| 107 static bool incognito(const ContentSettingPatternSource& r) { | 111 static bool incognito(const ContentSettingPatternSource& r) { |
| 108 return r.incognito; | 112 return r.incognito; |
| 109 } | 113 } |
| 110 | 114 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 133 } | 137 } |
| 134 | 138 |
| 135 static bool Read( | 139 static bool Read( |
| 136 content_settings::mojom::RendererContentSettingRulesDataView data, | 140 content_settings::mojom::RendererContentSettingRulesDataView data, |
| 137 RendererContentSettingRules* out); | 141 RendererContentSettingRules* out); |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 } // namespace mojo | 144 } // namespace mojo |
| 141 | 145 |
| 142 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAIT
S_H | 146 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAIT
S_H |
| OLD | NEW |