| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/shared_impl/ppapi_globals.h" | 8 #include "ppapi/shared_impl/ppapi_globals.h" |
| 9 #include "ppapi/shared_impl/var.h" | 9 #include "ppapi/shared_impl/var.h" |
| 10 #include "ppapi/shared_impl/var_tracker.h" | 10 #include "ppapi/shared_impl/var_tracker.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 | 13 |
| 14 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields() {} |
| 15 |
| 16 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields( |
| 17 const PPB_X509Certificate_Fields& fields) { |
| 18 values_.Swap(fields.values_.DeepCopy()); |
| 19 } |
| 20 |
| 14 void PPB_X509Certificate_Fields::SetField( | 21 void PPB_X509Certificate_Fields::SetField( |
| 15 PP_X509Certificate_Private_Field field, | 22 PP_X509Certificate_Private_Field field, |
| 16 base::Value* value) { | 23 base::Value* value) { |
| 17 uint32_t index = static_cast<uint32_t>(field); | 24 uint32_t index = static_cast<uint32_t>(field); |
| 18 bool success = values_.Set(index, value); | 25 bool success = values_.Set(index, value); |
| 19 DCHECK(success); | 26 DCHECK(success); |
| 20 } | 27 } |
| 21 | 28 |
| 22 PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( | 29 PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( |
| 23 PP_X509Certificate_Private_Field field) const { | 30 PP_X509Certificate_Private_Field field) const { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 //------------------------------------------------------------------------------ | 84 //------------------------------------------------------------------------------ |
| 78 | 85 |
| 79 PPB_X509Certificate_Private_Shared::PPB_X509Certificate_Private_Shared( | 86 PPB_X509Certificate_Private_Shared::PPB_X509Certificate_Private_Shared( |
| 80 ResourceObjectType type, | 87 ResourceObjectType type, |
| 81 PP_Instance instance) : Resource(type, instance), fields_(NULL) { | 88 PP_Instance instance) : Resource(type, instance), fields_(NULL) { |
| 82 } | 89 } |
| 83 | 90 |
| 84 PPB_X509Certificate_Private_Shared::PPB_X509Certificate_Private_Shared( | 91 PPB_X509Certificate_Private_Shared::PPB_X509Certificate_Private_Shared( |
| 85 ResourceObjectType type, | 92 ResourceObjectType type, |
| 86 PP_Instance instance, | 93 PP_Instance instance, |
| 87 PPB_X509Certificate_Fields* fields) | 94 const PPB_X509Certificate_Fields& fields) |
| 88 : Resource(type, instance), | 95 : Resource(type, instance), |
| 89 fields_(fields) { | 96 fields_(new PPB_X509Certificate_Fields(fields)) { |
| 90 } | 97 } |
| 91 | 98 |
| 92 PPB_X509Certificate_Private_Shared::~PPB_X509Certificate_Private_Shared() { | 99 PPB_X509Certificate_Private_Shared::~PPB_X509Certificate_Private_Shared() { |
| 93 } | 100 } |
| 94 | 101 |
| 95 thunk::PPB_X509Certificate_Private_API* | 102 thunk::PPB_X509Certificate_Private_API* |
| 96 PPB_X509Certificate_Private_Shared::AsPPB_X509Certificate_Private_API() { | 103 PPB_X509Certificate_Private_Shared::AsPPB_X509Certificate_Private_API() { |
| 97 return this; | 104 return this; |
| 98 } | 105 } |
| 99 | 106 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 129 const std::vector<char>& der, | 136 const std::vector<char>& der, |
| 130 PPB_X509Certificate_Fields* result) { | 137 PPB_X509Certificate_Fields* result) { |
| 131 // A concrete PPB_X509Certificate_Private_Shared should only ever be | 138 // A concrete PPB_X509Certificate_Private_Shared should only ever be |
| 132 // constructed by passing in PPB_X509Certificate_Fields, in which case it is | 139 // constructed by passing in PPB_X509Certificate_Fields, in which case it is |
| 133 // already initialized. | 140 // already initialized. |
| 134 CHECK(false); | 141 CHECK(false); |
| 135 return false; | 142 return false; |
| 136 } | 143 } |
| 137 | 144 |
| 138 } // namespace ppapi | 145 } // namespace ppapi |
| OLD | NEW |