1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gl/gl_version_info.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h"
13 GLVersionInfo::GLVersionInfo(const char* version_str
, const char* renderer_str
)
20 std::string
lstr(base::StringToLowerASCII(std::string(version_str
)));
21 is_es
= (lstr
.length() > 12) && (lstr
.substr(0, 9) == "opengl es");
23 lstr
= lstr
.substr(10, 3);
24 base::StringTokenizer
tokenizer(lstr
.begin(), lstr
.end(), ".");
25 unsigned major
, minor
;
26 if (tokenizer
.GetNext() &&
27 base::StringToUint(tokenizer
.token_piece(), &major
)) {
28 major_version
= major
;
29 if (tokenizer
.GetNext() &&
30 base::StringToUint(tokenizer
.token_piece(), &minor
)) {
31 minor_version
= minor
;
34 if (is_es
&& major_version
== 3)
38 is_angle
= StartsWithASCII(renderer_str
, "ANGLE", true);