| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ | 5 #ifndef COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ |
| 6 #define COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ | 6 #define COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "components/favicon_base/fallback_icon_style.h" |
| 12 | 13 |
| 13 // A parser for parameters to the chrome://large-icon/ host. | 14 // A parser for parameters to the chrome://large-icon/ host. |
| 14 class LargeIconUrlParser { | 15 class LargeIconUrlParser { |
| 15 public: | 16 public: |
| 16 LargeIconUrlParser(); | 17 LargeIconUrlParser(); |
| 17 ~LargeIconUrlParser(); | 18 ~LargeIconUrlParser(); |
| 18 | 19 |
| 19 std::string url_string() const { return url_string_; } | 20 std::string url_string() const { return url_string_; } |
| 20 | 21 |
| 21 int size_in_pixels() const { return size_in_pixels_; } | 22 int size_in_pixels() const { return size_in_pixels_; } |
| 22 | 23 |
| 23 size_t path_index() const { return path_index_; } | 24 size_t path_index() const { return path_index_; } |
| 24 | 25 |
| 26 const favicon_base::FallbackIconStyle& fallback_icon_style() const { |
| 27 return fallback_icon_style_; |
| 28 } |
| 29 |
| 25 // Parses |path|, which should be in the format described at the top of the | 30 // Parses |path|, which should be in the format described at the top of the |
| 26 // file "chrome/browser/ui/webui/large_icon_source.h". Note that |path| does | 31 // file "chrome/browser/ui/webui/large_icon_source.h". Note that |path| does |
| 27 // not have leading '/'. | 32 // not have leading '/'. |
| 28 bool Parse(base::StringPiece path); | 33 bool Parse(std::string path); |
| 29 | 34 |
| 30 private: | 35 private: |
| 31 friend class LargeIconUrlParserTest; | 36 friend class LargeIconUrlParserTest; |
| 32 | 37 |
| 33 // The page URL string of the requested large icon. | 38 // The page URL string of the requested large icon. |
| 34 std::string url_string_; | 39 std::string url_string_; |
| 35 | 40 |
| 36 // The size of the requested large icon in pixels. | 41 // The size of the requested large icon in pixels. |
| 37 int size_in_pixels_; | 42 int size_in_pixels_; |
| 38 | 43 |
| 39 // The index of the first character (relative to the path) where the the URL | 44 // The index of the first character (relative to the path) where the the URL |
| 40 // from which the large icon is being requested is located. | 45 // from which the large icon is being requested is located. |
| 41 size_t path_index_; | 46 size_t path_index_; |
| 42 | 47 |
| 48 // Styling specifications of fallback icon. |
| 49 favicon_base::FallbackIconStyle fallback_icon_style_; |
| 50 |
| 43 DISALLOW_COPY_AND_ASSIGN(LargeIconUrlParser); | 51 DISALLOW_COPY_AND_ASSIGN(LargeIconUrlParser); |
| 44 }; | 52 }; |
| 45 | 53 |
| 46 #endif // COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ | 54 #endif // COMPONENTS_FAVICON_BASE_LARGE_ICON_URL_PARSER_H_ |
| OLD | NEW |