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

Side by Side Diff: chrome/common/renderer_configuration_struct_traits.h

Issue 2582203003: Convert SetContentSettingRules to use mojo, part 1/2. (Closed)
Patch Set: Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_
6 #define CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "chrome/common/renderer_configuration.mojom.h"
11 #include "components/content_settings/core/common/content_settings.h"
12 #include "mojo/public/cpp/bindings/enum_traits.h"
13 #include "mojo/public/cpp/bindings/struct_traits.h"
14
15 namespace mojo {
16
17 template <>
18 struct EnumTraits<chrome::mojom::ContentSetting, ContentSetting> {
19 static chrome::mojom::ContentSetting ToMojom(ContentSetting setting);
20
21 static bool FromMojom(chrome::mojom::ContentSetting setting,
22 ContentSetting* out);
23 };
24
25 template <>
26 struct StructTraits<chrome::mojom::ContentSettingPatternSourceDataView,
27 ContentSettingPatternSource> {
28 static const std::string primary_pattern(
Sam McNally 2016/12/19 00:17:51 Inline simple accessors.
nigeltao1 2016/12/22 04:09:46 Done.
29 const ContentSettingPatternSource& r);
30 static const std::string secondary_pattern(
31 const ContentSettingPatternSource& r);
32 static ContentSetting setting(const ContentSettingPatternSource& r);
33 static const std::string& source(const ContentSettingPatternSource& r);
34 static bool incognito(const ContentSettingPatternSource& r);
35
36 static bool Read(chrome::mojom::ContentSettingPatternSourceDataView data,
37 ContentSettingPatternSource* out);
38 };
39
40 template <>
41 struct StructTraits<chrome::mojom::RendererContentSettingRulesDataView,
42 RendererContentSettingRules> {
43 static const std::vector<ContentSettingPatternSource>& image_rules(
44 const RendererContentSettingRules& r);
45 static const std::vector<ContentSettingPatternSource>& script_rules(
46 const RendererContentSettingRules& r);
47 static const std::vector<ContentSettingPatternSource>& autoplay_rules(
48 const RendererContentSettingRules& r);
49
50 static bool Read(chrome::mojom::RendererContentSettingRulesDataView data,
51 RendererContentSettingRules* out);
52 };
53
54 } // namespace mojo
55
56 #endif // CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698