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 <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/base/layout.h" | |
11 | |
12 namespace chrome { | 10 namespace chrome { |
13 | 11 |
14 struct ParsedFaviconPath { | 12 struct ParsedFaviconPath { |
15 // Whether the URL has the "iconurl" parameter. | 13 // Whether the URL has the "iconurl" parameter. |
16 bool is_icon_url; | 14 bool is_icon_url; |
17 | 15 |
18 // The URL from which the favicon is being requested. | 16 // The URL from which the favicon is being requested. |
19 std::string url; | 17 std::string url; |
20 | 18 |
21 // The size of the requested favicon in dip. | 19 // The size of the requested favicon in dip. |
22 int size_in_dip; | 20 int size_in_dip; |
23 | 21 |
24 // The scale factor of the requested favicon. | 22 // The scale factor of the requested favicon. |
25 ui::ScaleFactor scale_factor; | 23 float scale_factor; |
26 | 24 |
27 // The index of the first character (relative to the path) where the the URL | 25 // The index of the first character (relative to the path) where the the URL |
28 // from which the favicon is being requested is located. | 26 // from which the favicon is being requested is located. |
29 size_t path_index; | 27 size_t path_index; |
30 }; | 28 }; |
31 | 29 |
32 // 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 |
33 // file "chrome/browser/ui/webui/favicon_source.h". |icon_types| indicates | 31 // file "chrome/browser/ui/webui/favicon_source.h". |icon_types| indicates |
34 // which icon types are supported. Returns true if |path| could be parsed. | 32 // which icon types are supported. Returns true if |path| could be parsed. |
35 // The result of the parsing will be stored in a ParsedFaviconPath struct. | 33 // The result of the parsing will be stored in a ParsedFaviconPath struct. |
36 bool ParseFaviconPath(const std::string& path, | 34 bool ParseFaviconPath(const std::string& path, |
37 int icon_types, | 35 int icon_types, |
38 ParsedFaviconPath* parsed); | 36 ParsedFaviconPath* parsed); |
39 | 37 |
40 } // namespace chrome | 38 } // namespace chrome |
41 | 39 |
42 #endif // CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ | 40 #endif // CHROME_COMMON_FAVICON_FAVICON_URL_PARSER_H_ |
OLD | NEW |