Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | remoting/host/host_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ppapi/shared_impl/ppapi_globals.h" 10 #include "ppapi/shared_impl/ppapi_globals.h"
(...skipping 23 matching lines...) Expand all
34 uint32_t index = static_cast<uint32_t>(field); 34 uint32_t index = static_cast<uint32_t>(field);
35 const base::Value* value; 35 const base::Value* value;
36 bool success = values_.Get(index, &value); 36 bool success = values_.Get(index, &value);
37 if (!success) { 37 if (!success) {
38 // 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
39 // return null if the index is OOB. 39 // return null if the index is OOB.
40 return PP_MakeNull(); 40 return PP_MakeNull();
41 } 41 }
42 42
43 switch (value->GetType()) { 43 switch (value->GetType()) {
44 case base::Value::TYPE_NULL: 44 case base::Value::Type::NONE:
45 return PP_MakeNull(); 45 return PP_MakeNull();
46 case base::Value::TYPE_BOOLEAN: { 46 case base::Value::Type::BOOLEAN: {
47 bool val; 47 bool val;
48 value->GetAsBoolean(&val); 48 value->GetAsBoolean(&val);
49 return PP_MakeBool(PP_FromBool(val)); 49 return PP_MakeBool(PP_FromBool(val));
50 } 50 }
51 case base::Value::TYPE_INTEGER: { 51 case base::Value::Type::INTEGER: {
52 int val; 52 int val;
53 value->GetAsInteger(&val); 53 value->GetAsInteger(&val);
54 return PP_MakeInt32(val); 54 return PP_MakeInt32(val);
55 } 55 }
56 case base::Value::TYPE_DOUBLE: { 56 case base::Value::Type::DOUBLE: {
57 double val; 57 double val;
58 value->GetAsDouble(&val); 58 value->GetAsDouble(&val);
59 return PP_MakeDouble(val); 59 return PP_MakeDouble(val);
60 } 60 }
61 case base::Value::TYPE_STRING: { 61 case base::Value::Type::STRING: {
62 std::string val; 62 std::string val;
63 value->GetAsString(&val); 63 value->GetAsString(&val);
64 return StringVar::StringToPPVar(val); 64 return StringVar::StringToPPVar(val);
65 } 65 }
66 case base::Value::TYPE_BINARY: { 66 case base::Value::Type::BINARY: {
67 const base::BinaryValue* binary = 67 const base::BinaryValue* binary =
68 static_cast<const base::BinaryValue*>(value); 68 static_cast<const base::BinaryValue*>(value);
69 uint32_t size = static_cast<uint32_t>(binary->GetSize()); 69 uint32_t size = static_cast<uint32_t>(binary->GetSize());
70 const char* buffer = binary->GetBuffer(); 70 const char* buffer = binary->GetBuffer();
71 PP_Var array_buffer = 71 PP_Var array_buffer =
72 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(size, 72 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(size,
73 buffer); 73 buffer);
74 return array_buffer; 74 return array_buffer;
75 } 75 }
76 case base::Value::TYPE_DICTIONARY: 76 case base::Value::Type::DICTIONARY:
77 case base::Value::TYPE_LIST: 77 case base::Value::Type::LIST:
78 // Not handled. 78 // Not handled.
79 break; 79 break;
80 } 80 }
81 81
82 // Should not reach here. 82 // Should not reach here.
83 CHECK(false); 83 CHECK(false);
84 return PP_MakeUndefined(); 84 return PP_MakeUndefined();
85 } 85 }
86 86
87 //------------------------------------------------------------------------------ 87 //------------------------------------------------------------------------------
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const std::vector<char>& der, 139 const std::vector<char>& der,
140 PPB_X509Certificate_Fields* result) { 140 PPB_X509Certificate_Fields* result) {
141 // A concrete PPB_X509Certificate_Private_Shared should only ever be 141 // A concrete PPB_X509Certificate_Private_Shared should only ever be
142 // 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
143 // already initialized. 143 // already initialized.
144 CHECK(false); 144 CHECK(false);
145 return false; 145 return false;
146 } 146 }
147 147
148 } // namespace ppapi 148 } // namespace ppapi
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | remoting/host/host_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698