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

Side by Side Diff: content/renderer/manifest/manifest_parser.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/common/android/address_parser_internal.cc ('k') | device/bluetooth/bluetooth_device.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 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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "content/public/common/manifest.h" 14 #include "content/public/common/manifest.h"
15 #include "content/renderer/manifest/manifest_uma_util.h" 15 #include "content/renderer/manifest/manifest_uma_util.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 namespace { 20 namespace {
21 21
22 // Helper function that returns whether the given |str| is a valid width or 22 // Helper function that returns whether the given |str| is a valid width or
23 // height value for an icon sizes per: 23 // height value for an icon sizes per:
24 // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes 24 // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes
25 bool IsValidIconWidthOrHeight(const std::string& str) { 25 bool IsValidIconWidthOrHeight(const std::string& str) {
26 if (str.empty() || str[0] == '0') 26 if (str.empty() || str[0] == '0')
27 return false; 27 return false;
28 for (size_t i = 0; i < str.size(); ++i) 28 for (size_t i = 0; i < str.size(); ++i)
29 if (!IsAsciiDigit(str[i])) 29 if (!base::IsAsciiDigit(str[i]))
30 return false; 30 return false;
31 return true; 31 return true;
32 } 32 }
33 33
34 // Parses the 'sizes' attribute of an icon as described in the HTML spec: 34 // Parses the 'sizes' attribute of an icon as described in the HTML spec:
35 // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes 35 // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes
36 // Return a vector of gfx::Size that contains the valid sizes found. "Any" is 36 // Return a vector of gfx::Size that contains the valid sizes found. "Any" is
37 // represented by gfx::Size(0, 0). 37 // represented by gfx::Size(0, 0).
38 // TODO(mlamouri): this is implemented as a separate function because it should 38 // TODO(mlamouri): this is implemented as a separate function because it should
39 // be refactored with the other icon sizes parsing implementations, see 39 // be refactored with the other icon sizes parsing implementations, see
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 const base::DictionaryValue& dictionary) { 406 const base::DictionaryValue& dictionary) {
407 return ParseBoolean(dictionary, "prefer_related_applications", false); 407 return ParseBoolean(dictionary, "prefer_related_applications", false);
408 } 408 }
409 409
410 base::NullableString16 ManifestParser::ParseGCMSenderID( 410 base::NullableString16 ManifestParser::ParseGCMSenderID(
411 const base::DictionaryValue& dictionary) { 411 const base::DictionaryValue& dictionary) {
412 return ParseString(dictionary, "gcm_sender_id", Trim); 412 return ParseString(dictionary, "gcm_sender_id", Trim);
413 } 413 }
414 414
415 } // namespace content 415 } // namespace content
OLDNEW
« no previous file with comments | « content/common/android/address_parser_internal.cc ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698