Chromium Code Reviews| Index: chrome/common/favicon_url_parser.h |
| diff --git a/chrome/common/favicon_url_parser.h b/chrome/common/favicon_url_parser.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4c10c40e34e105734bc7878467ec95aa600bcbb9 |
| --- /dev/null |
| +++ b/chrome/common/favicon_url_parser.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_COMMON_FAVICON_URL_PARSER_H_ |
| +#define CHROME_COMMON_FAVICON_URL_PARSER_H_ |
| + |
| +#include <string> |
| + |
| +#include "ui/base/layout.h" |
| + |
| +namespace chrome { |
| + |
| +struct ParsedFaviconPath { |
|
samarth
2013/06/20 00:31:29
Document the fields here, rather than below.
pedro (no code reviews)
2013/06/20 22:43:45
Done.
|
| + bool is_icon_url; |
| + std::string url; |
| + int size_in_dip; |
| + ui::ScaleFactor scale_factor; |
| + size_t path_index; |
| +}; |
| + |
| +// Parses |path|, which should be in the format described at the top of the |
| +// file "chrome/browser/ui/webui/favicon_source.h". |icon_types| indicates |
| +// which icon types are supported. Returns true if |path| could be parsed. |
| +// The result of the parsing will be stored in a ParsedFaviconPath struct. |
| +// |
| +// This function will return a struct containing the following information: |
| +// |
| +// is_icon_url - whether the URL has the "iconurl" parameter. |
| +// url - the URL from which the favicon is being requested. |
| +// size_in_dip - the size of the requested favicon |
| +// scale_factor - the scale factor of the requested favicon |
| +// path_index - the index of the first character (relative to the path) |
| +// where the the URL from which the favicon is being requested |
| +// is located. |
| +bool ParseFaviconPath(const std::string& path, |
| + int icon_types, |
| + ParsedFaviconPath* parsed); |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_COMMON_FAVICON_URL_PARSER_H_ |