Index: chrome/common/renderer_configuration_struct_traits.h |
diff --git a/chrome/common/renderer_configuration_struct_traits.h b/chrome/common/renderer_configuration_struct_traits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f67436a1abc120e8e50767f680ad80e3d6df3891 |
--- /dev/null |
+++ b/chrome/common/renderer_configuration_struct_traits.h |
@@ -0,0 +1,56 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_ |
+#define CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_ |
+ |
+#include <string> |
+ |
+#include "chrome/common/renderer_configuration.mojom.h" |
+#include "components/content_settings/core/common/content_settings.h" |
+#include "mojo/public/cpp/bindings/enum_traits.h" |
+#include "mojo/public/cpp/bindings/struct_traits.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct EnumTraits<chrome::mojom::ContentSetting, ContentSetting> { |
+ static chrome::mojom::ContentSetting ToMojom(ContentSetting setting); |
+ |
+ static bool FromMojom(chrome::mojom::ContentSetting setting, |
+ ContentSetting* out); |
+}; |
+ |
+template <> |
+struct StructTraits<chrome::mojom::ContentSettingPatternSourceDataView, |
+ ContentSettingPatternSource> { |
+ 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.
|
+ const ContentSettingPatternSource& r); |
+ static const std::string secondary_pattern( |
+ const ContentSettingPatternSource& r); |
+ static ContentSetting setting(const ContentSettingPatternSource& r); |
+ static const std::string& source(const ContentSettingPatternSource& r); |
+ static bool incognito(const ContentSettingPatternSource& r); |
+ |
+ static bool Read(chrome::mojom::ContentSettingPatternSourceDataView data, |
+ ContentSettingPatternSource* out); |
+}; |
+ |
+template <> |
+struct StructTraits<chrome::mojom::RendererContentSettingRulesDataView, |
+ RendererContentSettingRules> { |
+ static const std::vector<ContentSettingPatternSource>& image_rules( |
+ const RendererContentSettingRules& r); |
+ static const std::vector<ContentSettingPatternSource>& script_rules( |
+ const RendererContentSettingRules& r); |
+ static const std::vector<ContentSettingPatternSource>& autoplay_rules( |
+ const RendererContentSettingRules& r); |
+ |
+ static bool Read(chrome::mojom::RendererContentSettingRulesDataView data, |
+ RendererContentSettingRules* out); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // CHROME_COMMON_RENDERER_CONFIGURATION_STRUCT_TRAITS_H_ |