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 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" | 5 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "ppapi/shared_impl/ppapi_globals.h" | 10 #include "ppapi/shared_impl/ppapi_globals.h" |
9 #include "ppapi/shared_impl/var.h" | 11 #include "ppapi/shared_impl/var.h" |
10 #include "ppapi/shared_impl/var_tracker.h" | 12 #include "ppapi/shared_impl/var_tracker.h" |
11 | 13 |
12 namespace ppapi { | 14 namespace ppapi { |
13 | 15 |
14 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields() {} | 16 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields() {} |
15 | 17 |
16 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields( | 18 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields( |
17 const PPB_X509Certificate_Fields& fields) { | 19 const PPB_X509Certificate_Fields& fields) { |
18 std::unique_ptr<base::ListValue> new_values(fields.values_.DeepCopy()); | 20 std::unique_ptr<base::ListValue> new_values(fields.values_.DeepCopy()); |
19 values_.Swap(new_values.get()); | 21 values_.Swap(new_values.get()); |
20 } | 22 } |
21 | 23 |
22 void PPB_X509Certificate_Fields::SetField( | 24 void PPB_X509Certificate_Fields::SetField( |
23 PP_X509Certificate_Private_Field field, | 25 PP_X509Certificate_Private_Field field, |
24 base::Value* value) { | 26 std::unique_ptr<base::Value> value) { |
25 uint32_t index = static_cast<uint32_t>(field); | 27 uint32_t index = static_cast<uint32_t>(field); |
26 bool success = values_.Set(index, value); | 28 bool success = values_.Set(index, std::move(value)); |
27 DCHECK(success); | 29 DCHECK(success); |
28 } | 30 } |
29 | 31 |
30 PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( | 32 PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( |
31 PP_X509Certificate_Private_Field field) const { | 33 PP_X509Certificate_Private_Field field) const { |
32 uint32_t index = static_cast<uint32_t>(field); | 34 uint32_t index = static_cast<uint32_t>(field); |
33 const base::Value* value; | 35 const base::Value* value; |
34 bool success = values_.Get(index, &value); | 36 bool success = values_.Get(index, &value); |
35 if (!success) { | 37 if (!success) { |
36 // Our list received might be smaller than the number of fields, so just | 38 // Our list received might be smaller than the number of fields, so just |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const std::vector<char>& der, | 139 const std::vector<char>& der, |
138 PPB_X509Certificate_Fields* result) { | 140 PPB_X509Certificate_Fields* result) { |
139 // A concrete PPB_X509Certificate_Private_Shared should only ever be | 141 // A concrete PPB_X509Certificate_Private_Shared should only ever be |
140 // constructed by passing in PPB_X509Certificate_Fields, in which case it is | 142 // constructed by passing in PPB_X509Certificate_Fields, in which case it is |
141 // already initialized. | 143 // already initialized. |
142 CHECK(false); | 144 CHECK(false); |
143 return false; | 145 return false; |
144 } | 146 } |
145 | 147 |
146 } // namespace ppapi | 148 } // namespace ppapi |
OLD | NEW |