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

Side by Side Diff: chrome/common/favicon/large_icon_url_parser.h

Issue 1014853004: [Icons NTP] Add LargeIconUrlParser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use base::StringPiece; fix tests. Created 5 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
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 #ifndef CHROME_COMMON_FAVICON_LARGE_ICON_URL_PARSER_H_
6 #define CHROME_COMMON_FAVICON_LARGE_ICON_URL_PARSER_H_
7
8 #include <string>
9
10 #include "base/gtest_prod_util.h"
Lei Zhang 2015/03/18 19:00:45 not needed?
huangs 2015/03/18 20:18:04 Done.
11 #include "base/macros.h"
12 #include "base/strings/string_piece.h"
13
14 namespace chrome {
Lei Zhang 2015/03/18 19:00:45 We've decided to stop using namespace chrome. Plea
huangs 2015/03/18 20:18:04 Done.
15
16 // A parser for parameters to the chrome://large-icon/ host.
17 class LargeIconUrlParser {
18 public:
19 LargeIconUrlParser();
20 ~LargeIconUrlParser();
21
22 std::string url_string() const { return url_string_; }
23
24 int size_in_pixels() const { return size_in_pixels_; }
25
26 size_t path_index() const { return path_index_; }
27
28 // Parses |path|, which should be in the format described at the top of the
29 // file "chrome/browser/ui/webui/large_icon_source.h". Note that |path| does
30 // not have leading '/'.
31 bool Parse(base::StringPiece path);
32
33 private:
34
Lei Zhang 2015/03/18 19:00:45 nit: no blank line here. "git cl lint" can probabl
huangs 2015/03/18 20:18:04 Done.
35 friend class LargeIconUrlParserTest;
36
37 // The page URL string of the requested large icon.
38 std::string url_string_;
39
40 // The size of the requested large icon in pixels.
41 int size_in_pixels_;
42
43 // The index of the first character (relative to the path) where the the URL
44 // from which the large icon is being requested is located.
45 size_t path_index_;
46
47 DISALLOW_COPY_AND_ASSIGN(LargeIconUrlParser);
48 };
49
50 } // namespace chrome
51
52 #endif // CHROME_COMMON_FAVICON_LARGE_ICON_URL_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698