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

Side by Side Diff: components/content_settings/core/common/content_settings_struct_traits.h

Issue 2938163002: Store base::Value in ContentSettingPatternSource instead of an enum (Closed)
Patch Set: raymes comments Created 3 years, 5 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 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/common_custom_types_struct_traits.h"
15 #include "mojo/common/values_struct_traits.h"
12 #include "mojo/public/cpp/bindings/enum_traits.h" 16 #include "mojo/public/cpp/bindings/enum_traits.h"
13 #include "mojo/public/cpp/bindings/struct_traits.h" 17 #include "mojo/public/cpp/bindings/struct_traits.h"
14 18
15 namespace mojo { 19 namespace mojo {
16 20
17 template <> 21 template <>
18 struct StructTraits<content_settings::mojom::PatternPartsDataView, 22 struct StructTraits<content_settings::mojom::PatternPartsDataView,
19 ContentSettingsPattern::PatternParts> { 23 ContentSettingsPattern::PatternParts> {
20 static const std::string& scheme( 24 static const std::string& scheme(
21 const ContentSettingsPattern::PatternParts& r) { 25 const ContentSettingsPattern::PatternParts& r) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static const ContentSettingsPattern& primary_pattern( 93 static const ContentSettingsPattern& primary_pattern(
90 const ContentSettingPatternSource& r) { 94 const ContentSettingPatternSource& r) {
91 return r.primary_pattern; 95 return r.primary_pattern;
92 } 96 }
93 97
94 static const ContentSettingsPattern& secondary_pattern( 98 static const ContentSettingsPattern& secondary_pattern(
95 const ContentSettingPatternSource& r) { 99 const ContentSettingPatternSource& r) {
96 return r.secondary_pattern; 100 return r.secondary_pattern;
97 } 101 }
98 102
99 static ContentSetting setting(const ContentSettingPatternSource& r) { 103 static const std::unique_ptr<base::Value>& setting_value(
100 return r.setting; 104 const ContentSettingPatternSource& r) {
105 return r.setting_value;
101 } 106 }
102 107
103 static const std::string& source(const ContentSettingPatternSource& r) { 108 static const std::string& source(const ContentSettingPatternSource& r) {
104 return r.source; 109 return r.source;
105 } 110 }
106 111
107 static bool incognito(const ContentSettingPatternSource& r) { 112 static bool incognito(const ContentSettingPatternSource& r) {
108 return r.incognito; 113 return r.incognito;
109 } 114 }
110 115
(...skipping 22 matching lines...) Expand all
133 } 138 }
134 139
135 static bool Read( 140 static bool Read(
136 content_settings::mojom::RendererContentSettingRulesDataView data, 141 content_settings::mojom::RendererContentSettingRulesDataView data,
137 RendererContentSettingRules* out); 142 RendererContentSettingRules* out);
138 }; 143 };
139 144
140 } // namespace mojo 145 } // namespace mojo
141 146
142 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAIT S_H 147 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_STRUCT_TRAIT S_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698