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

Side by Side Diff: ppapi/shared_impl/var.cc

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
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/var.h" 5 #include "ppapi/shared_impl/var.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 PP_VarType StringVar::GetType() const { return PP_VARTYPE_STRING; } 141 PP_VarType StringVar::GetType() const { return PP_VARTYPE_STRING; }
142 142
143 // static 143 // static
144 PP_Var StringVar::StringToPPVar(const std::string& var) { 144 PP_Var StringVar::StringToPPVar(const std::string& var) {
145 return StringToPPVar(var.c_str(), static_cast<uint32>(var.size())); 145 return StringToPPVar(var.c_str(), static_cast<uint32>(var.size()));
146 } 146 }
147 147
148 // static 148 // static
149 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) { 149 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) {
150 scoped_refptr<StringVar> str(new StringVar(data, len)); 150 scoped_refptr<StringVar> str(new StringVar(data, len));
151 if (!str.get() || !IsStringUTF8(str->value())) 151 if (!str.get() || !base::IsStringUTF8(str->value()))
152 return PP_MakeNull(); 152 return PP_MakeNull();
153 return str->GetPPVar(); 153 return str->GetPPVar();
154 } 154 }
155 155
156 // static 156 // static
157 StringVar* StringVar::FromPPVar(PP_Var var) { 157 StringVar* StringVar::FromPPVar(PP_Var var) {
158 if (var.type != PP_VARTYPE_STRING) 158 if (var.type != PP_VARTYPE_STRING)
159 return NULL; 159 return NULL;
160 scoped_refptr<Var> var_object( 160 scoped_refptr<Var> var_object(
161 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 161 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
(...skipping 24 matching lines...) Expand all
186 if (var.type != PP_VARTYPE_ARRAY_BUFFER) 186 if (var.type != PP_VARTYPE_ARRAY_BUFFER)
187 return NULL; 187 return NULL;
188 scoped_refptr<Var> var_object( 188 scoped_refptr<Var> var_object(
189 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 189 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
190 if (!var_object.get()) 190 if (!var_object.get())
191 return NULL; 191 return NULL;
192 return var_object->AsArrayBufferVar(); 192 return var_object->AsArrayBufferVar();
193 } 193 }
194 194
195 } // namespace ppapi 195 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/file_ref_util.cc ('k') | remoting/protocol/me2me_host_authenticator_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698