OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 PayloadProto& payload() { | 127 PayloadProto& payload() { |
128 if (!payload_.get()) | 128 if (!payload_.get()) |
129 payload_.reset(new PayloadProto()); | 129 payload_.reset(new PayloadProto()); |
130 return *payload_; | 130 return *payload_; |
131 } | 131 } |
132 void clear_payload() { | 132 void clear_payload() { |
133 payload_.reset(); | 133 payload_.reset(); |
134 } | 134 } |
135 | 135 |
136 // PolicyBuilder: | 136 // PolicyBuilder: |
137 virtual void Build() OVERRIDE { | 137 virtual void Build() override { |
138 if (payload_.get()) | 138 if (payload_.get()) |
139 CHECK(payload_->SerializeToString(policy_data().mutable_policy_value())); | 139 CHECK(payload_->SerializeToString(policy_data().mutable_policy_value())); |
140 | 140 |
141 PolicyBuilder::Build(); | 141 PolicyBuilder::Build(); |
142 } | 142 } |
143 | 143 |
144 private: | 144 private: |
145 scoped_ptr<PayloadProto> payload_; | 145 scoped_ptr<PayloadProto> payload_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(TypedPolicyBuilder); | 147 DISALLOW_COPY_AND_ASSIGN(TypedPolicyBuilder); |
148 }; | 148 }; |
149 | 149 |
150 typedef TypedPolicyBuilder<enterprise_management::CloudPolicySettings> | 150 typedef TypedPolicyBuilder<enterprise_management::CloudPolicySettings> |
151 UserPolicyBuilder; | 151 UserPolicyBuilder; |
152 | 152 |
153 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 153 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
154 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData> | 154 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData> |
155 ComponentPolicyBuilder; | 155 ComponentPolicyBuilder; |
156 #endif | 156 #endif |
157 | 157 |
158 } // namespace policy | 158 } // namespace policy |
159 | 159 |
160 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ | 160 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ |
OLD | NEW |