OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "content/renderer/manifest/manifest_parser.h" | 5 #include "content/renderer/manifest/manifest_parser.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // represented by gfx::Size(0, 0). | 40 // represented by gfx::Size(0, 0). |
41 // TODO(mlamouri): this is implemented as a separate function because it should | 41 // TODO(mlamouri): this is implemented as a separate function because it should |
42 // be refactored with the other icon sizes parsing implementations, see | 42 // be refactored with the other icon sizes parsing implementations, see |
43 // http://crbug.com/416477 | 43 // http://crbug.com/416477 |
44 std::vector<gfx::Size> ParseIconSizesHTML(const base::string16& sizes_str16) { | 44 std::vector<gfx::Size> ParseIconSizesHTML(const base::string16& sizes_str16) { |
45 if (!base::IsStringASCII(sizes_str16)) | 45 if (!base::IsStringASCII(sizes_str16)) |
46 return std::vector<gfx::Size>(); | 46 return std::vector<gfx::Size>(); |
47 | 47 |
48 std::vector<gfx::Size> sizes; | 48 std::vector<gfx::Size> sizes; |
49 std::string sizes_str = | 49 std::string sizes_str = |
50 base::StringToLowerASCII(base::UTF16ToUTF8(sizes_str16)); | 50 base::ToLowerASCII(base::UTF16ToUTF8(sizes_str16)); |
51 std::vector<std::string> sizes_str_list = base::SplitString( | 51 std::vector<std::string> sizes_str_list = base::SplitString( |
52 sizes_str, base::kWhitespaceASCII, base::KEEP_WHITESPACE, | 52 sizes_str, base::kWhitespaceASCII, base::KEEP_WHITESPACE, |
53 base::SPLIT_WANT_NONEMPTY); | 53 base::SPLIT_WANT_NONEMPTY); |
54 | 54 |
55 for (size_t i = 0; i < sizes_str_list.size(); ++i) { | 55 for (size_t i = 0; i < sizes_str_list.size(); ++i) { |
56 std::string& size_str = sizes_str_list[i]; | 56 std::string& size_str = sizes_str_list[i]; |
57 if (size_str == "any") { | 57 if (size_str == "any") { |
58 sizes.push_back(gfx::Size(0, 0)); | 58 sizes.push_back(gfx::Size(0, 0)); |
59 continue; | 59 continue; |
60 } | 60 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 int32_t signed_color = reinterpret_cast<int32_t&>(color); | 434 int32_t signed_color = reinterpret_cast<int32_t&>(color); |
435 return static_cast<int64_t>(signed_color); | 435 return static_cast<int64_t>(signed_color); |
436 } | 436 } |
437 | 437 |
438 base::NullableString16 ManifestParser::ParseGCMSenderID( | 438 base::NullableString16 ManifestParser::ParseGCMSenderID( |
439 const base::DictionaryValue& dictionary) { | 439 const base::DictionaryValue& dictionary) { |
440 return ParseString(dictionary, "gcm_sender_id", Trim); | 440 return ParseString(dictionary, "gcm_sender_id", Trim); |
441 } | 441 } |
442 | 442 |
443 } // namespace content | 443 } // namespace content |
OLD | NEW |