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

Side by Side Diff: components/favicon_base/fallback_icon_url_parser.h

Issue 2883053003: Delete unused chrome://fallback-icon/ handling (Closed)
Patch Set: Merge branch 'master' into searchbox3 Created 3 years, 7 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 COMPONENTS_FAVICON_BASE_FALLBACK_ICON_URL_PARSER_H_
6 #define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_URL_PARSER_H_
7
8 #include <stddef.h>
9
10 #include <string>
11
12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h"
14 #include "components/favicon_base/fallback_icon_style.h"
15 #include "third_party/skia/include/core/SkColor.h"
16
17 namespace chrome {
18
19 class ParsedFallbackIconPath {
20 public:
21 ParsedFallbackIconPath();
22 ~ParsedFallbackIconPath();
23
24 const std::string& url_string() const { return url_string_; }
25
26 int size_in_pixels() const { return size_in_pixels_; }
27
28 const favicon_base::FallbackIconStyle& style() const { return style_; }
29
30 size_t path_index() const { return path_index_; }
31
32 // Parses |path|, which should be in the format described at the top of the
33 // file "chrome/browser/ui/webui/fallback_icon_source.h".
34 bool Parse(const std::string& path);
35
36 private:
37 // Parses |specs_str|, which should be the comma-separated value portion
38 // in the format described at the top of the file
39 // "chrome/browser/ui/webui/fallback_icon_source.h".
40 static bool ParseSpecs(const std::string& specs_str,
41 int *size,
42 favicon_base::FallbackIconStyle* style);
43
44 // Helper to parse color string (e.g., "red", "#f00", "#aB0137"). On success,
45 // returns true and writes te result to |*color|.
46 static bool ParseColor(const std::string& color_str, SkColor* color);
47
48 friend class FallbackIconUrlParserTest;
49 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseColorSuccess);
50 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseColorFailure);
51 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseSpecsEmpty);
52 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseSpecsPartial);
53 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseSpecsFull);
54 FRIEND_TEST_ALL_PREFIXES(FallbackIconUrlParserTest, ParseSpecsFailure);
55
56 // The page URL string the fallback icon is requested for.
57 std::string url_string_;
58
59 // The size of the requested fallback icon in pixels.
60 int size_in_pixels_;
61
62 // Styling specifications of fallback icon.
63 favicon_base::FallbackIconStyle style_;
64
65 // The index of the first character (relative to the path) where the the URL
66 // from which the fallback icon is being requested is located.
67 size_t path_index_;
68
69 DISALLOW_COPY_AND_ASSIGN(ParsedFallbackIconPath);
70 };
71
72 } // namespace chrome
73
74 #endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_URL_PARSER_H_
OLDNEW
« no previous file with comments | « components/favicon_base/fallback_icon_style.cc ('k') | components/favicon_base/fallback_icon_url_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698