| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ | 5 #ifndef CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ |
| 6 #define CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ | 6 #define CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 11 #include "components/favicon_base/fallback_icon_specs_builder.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" |
| 13 |
| 10 namespace chrome { | 14 namespace chrome { |
| 11 | 15 |
| 12 struct ParsedFaviconPath { | 16 struct ParsedFaviconPath { |
| 13 // Whether the URL has the "iconurl" parameter. | 17 // Whether the URL has the "iconurl" parameter. |
| 14 bool is_icon_url; | 18 bool is_icon_url; |
| 15 | 19 |
| 16 // The URL from which the favicon is being requested. | 20 // The URL from which the favicon is being requested. |
| 17 std::string url; | 21 std::string url; |
| 18 | 22 |
| 19 // The size of the requested favicon in dip. | 23 // The size of the requested favicon in dip. |
| 20 int size_in_dip; | 24 int size_in_dip; |
| 21 | 25 |
| 22 // The device scale factor of the requested favicon. | 26 // The device scale factor of the requested favicon. |
| 23 float device_scale_factor; | 27 float device_scale_factor; |
| 24 | 28 |
| 29 // Specifications of fallback icon. This is nullptr if no fallback. |
| 30 std::unique_ptr<favicon_base::FallbackIconSpecsBuilder> |
| 31 fallback_specs_builder; |
| 32 |
| 25 // The index of the first character (relative to the path) where the the URL | 33 // The index of the first character (relative to the path) where the the URL |
| 26 // from which the favicon is being requested is located. | 34 // from which the favicon is being requested is located. |
| 27 size_t path_index; | 35 size_t path_index; |
| 28 }; | 36 }; |
| 29 | 37 |
| 30 // Parses |path|, which should be in the format described at the top of the | 38 // Parses |path|, which should be in the format described at the top of the |
| 31 // file "chrome/browser/ui/webui/favicon_source.h". |icon_types| indicates | 39 // file "chrome/browser/ui/webui/favicon_source.h". |icon_types| indicates |
| 32 // which icon types are supported. Returns true if |path| could be parsed. | 40 // which icon types are supported. Returns true if |path| could be parsed. |
| 33 // The result of the parsing will be stored in a ParsedFaviconPath struct. | 41 // The result of the parsing will be stored in a ParsedFaviconPath struct. |
| 34 bool ParseFaviconPath(const std::string& path, | 42 bool ParseFaviconPath(const std::string& path, |
| 35 int icon_types, | 43 int icon_types, |
| 36 ParsedFaviconPath* parsed); | 44 ParsedFaviconPath* parsed); |
| 37 | 45 |
| 38 } // namespace chrome | 46 } // namespace chrome |
| 39 | 47 |
| 40 #endif // CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ | 48 #endif // CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ |
| OLD | NEW |