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

Side by Side Diff: components/favicon_base/large_icon_url_parser.cc

Issue 2917733002: Remove unused chrome://large-icon (Closed)
Patch Set: Created 3 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
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #include "components/favicon_base/large_icon_url_parser.h"
6
7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h"
11 #include "third_party/skia/include/utils/SkParse.h"
12 #include "ui/gfx/favicon_size.h"
13
14 LargeIconUrlParser::LargeIconUrlParser() : size_in_pixels_(48) {
15 }
16
17 LargeIconUrlParser::~LargeIconUrlParser() {
18 }
19
20 bool LargeIconUrlParser::Parse(base::StringPiece path) {
21 if (path.empty())
22 return false;
23
24 size_t slash = path.find("/", 0); // |path| does not start with '/'.
25 if (slash == base::StringPiece::npos)
26 return false;
27 base::StringPiece size_str = path.substr(0, slash);
28 // Disallow empty, non-numeric, or non-positive sizes.
29 if (size_str.empty() ||
30 !base::StringToInt(size_str, &size_in_pixels_) ||
31 size_in_pixels_ <= 0)
32 return false;
33
34 // Need to store the index of the URL field, so Instant Extended can translate
35 // large icon URLs using advanced parameters.
36 // Example:
37 // "chrome-search://large-icon/48/<renderer-id>/<most-visited-id>"
38 // would be translated to:
39 // "chrome-search://large-icon/48/<most-visited-item-with-given-id>".
40 path_index_ = slash + 1;
41 url_string_ = path.substr(path_index_).as_string();
42 return true;
43 }
OLDNEW
« no previous file with comments | « components/favicon_base/large_icon_url_parser.h ('k') | components/favicon_base/large_icon_url_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698