| 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_flash_x509_certificate_shared.h" | 5 #include "ppapi/shared_impl/private/ppb_flash_x509_certificate_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 |
| 17 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields( |
| 18 const PPB_X509Certificate_Fields& fields) { |
| 19 for (size_t i = 0; i < fields.values_.GetSize(); ++i) { |
| 20 base::Value* value; |
| 21 values_.Get(i, &value); |
| 22 values_.Append(value->DeepCopy()); |
| 23 } |
| 24 } |
| 25 |
| 14 PPB_X509Certificate_Fields::~PPB_X509Certificate_Fields() { | 26 PPB_X509Certificate_Fields::~PPB_X509Certificate_Fields() { |
| 15 } | 27 } |
| 16 | 28 |
| 17 void PPB_X509Certificate_Fields::SetField(PP_Flash_X509Certificate_Field field, | 29 void PPB_X509Certificate_Fields::SetField(PP_Flash_X509Certificate_Field field, |
| 18 base::Value* value) { | 30 base::Value* value) { |
| 19 uint32_t index = static_cast<uint32_t>(field); | 31 uint32_t index = static_cast<uint32_t>(field); |
| 20 bool success = values_.Set(index, value); | 32 bool success = values_.Set(index, value); |
| 21 DCHECK(success); | 33 DCHECK(success); |
| 22 } | 34 } |
| 23 | 35 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 PPB_Flash_X509Certificate_Shared::PPB_Flash_X509Certificate_Shared( | 93 PPB_Flash_X509Certificate_Shared::PPB_Flash_X509Certificate_Shared( |
| 82 ResourceObjectType type, | 94 ResourceObjectType type, |
| 83 PP_Instance instance) : | 95 PP_Instance instance) : |
| 84 Resource(type, instance), | 96 Resource(type, instance), |
| 85 fields_(NULL) { | 97 fields_(NULL) { |
| 86 } | 98 } |
| 87 | 99 |
| 88 PPB_Flash_X509Certificate_Shared::PPB_Flash_X509Certificate_Shared( | 100 PPB_Flash_X509Certificate_Shared::PPB_Flash_X509Certificate_Shared( |
| 89 ResourceObjectType type, | 101 ResourceObjectType type, |
| 90 PP_Instance instance, | 102 PP_Instance instance, |
| 91 PPB_X509Certificate_Fields* fields) : | 103 const PPB_X509Certificate_Fields& fields) : |
| 92 Resource(type, instance), | 104 Resource(type, instance), |
| 93 fields_(fields) | 105 fields_(new PPB_X509Certificate_Fields(fields)) |
| 94 { | 106 { |
| 95 } | 107 } |
| 96 | 108 |
| 97 PPB_Flash_X509Certificate_Shared::~PPB_Flash_X509Certificate_Shared() { | 109 PPB_Flash_X509Certificate_Shared::~PPB_Flash_X509Certificate_Shared() { |
| 98 } | 110 } |
| 99 | 111 |
| 100 thunk::PPB_Flash_X509Certificate_API* | 112 thunk::PPB_Flash_X509Certificate_API* |
| 101 PPB_Flash_X509Certificate_Shared::AsPPB_Flash_X509Certificate_API() { | 113 PPB_Flash_X509Certificate_Shared::AsPPB_Flash_X509Certificate_API() { |
| 102 return this; | 114 return this; |
| 103 } | 115 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 134 const std::vector<char>& der, | 146 const std::vector<char>& der, |
| 135 PPB_X509Certificate_Fields* result) { | 147 PPB_X509Certificate_Fields* result) { |
| 136 // A concrete PPB_Flash_X509Certificate_Shared should only ever be constructed | 148 // A concrete PPB_Flash_X509Certificate_Shared should only ever be constructed |
| 137 // by passing in PPB_X509Certificate_Fields, in which case it is already | 149 // by passing in PPB_X509Certificate_Fields, in which case it is already |
| 138 // initialized. | 150 // initialized. |
| 139 CHECK(false); | 151 CHECK(false); |
| 140 return false; | 152 return false; |
| 141 } | 153 } |
| 142 | 154 |
| 143 } // namespace ppapi | 155 } // namespace ppapi |
| OLD | NEW |