Chromium Code Reviews| Index: chrome/common/favicon/large_icon_url_parser.h |
| diff --git a/chrome/common/favicon/large_icon_url_parser.h b/chrome/common/favicon/large_icon_url_parser.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2a2d32bf764878dc0c9ce24982d213588d25a769 |
| --- /dev/null |
| +++ b/chrome/common/favicon/large_icon_url_parser.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2015 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_LARGE_ICON_URL_PARSER_H_ |
| +#define CHROME_COMMON_FAVICON_LARGE_ICON_URL_PARSER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/gtest_prod_util.h" |
|
Lei Zhang
2015/03/18 19:00:45
not needed?
huangs
2015/03/18 20:18:04
Done.
|
| +#include "base/macros.h" |
| +#include "base/strings/string_piece.h" |
| + |
| +namespace chrome { |
|
Lei Zhang
2015/03/18 19:00:45
We've decided to stop using namespace chrome. Plea
huangs
2015/03/18 20:18:04
Done.
|
| + |
| +// A parser for parameters to the chrome://large-icon/ host. |
| +class LargeIconUrlParser { |
| + public: |
| + LargeIconUrlParser(); |
| + ~LargeIconUrlParser(); |
| + |
| + std::string url_string() const { return url_string_; } |
| + |
| + int size_in_pixels() const { return size_in_pixels_; } |
| + |
| + size_t path_index() const { return path_index_; } |
| + |
| + // Parses |path|, which should be in the format described at the top of the |
| + // file "chrome/browser/ui/webui/large_icon_source.h". Note that |path| does |
| + // not have leading '/'. |
| + bool Parse(base::StringPiece path); |
| + |
| + private: |
| + |
|
Lei Zhang
2015/03/18 19:00:45
nit: no blank line here. "git cl lint" can probabl
huangs
2015/03/18 20:18:04
Done.
|
| + friend class LargeIconUrlParserTest; |
| + |
| + // The page URL string of the requested large icon. |
| + std::string url_string_; |
| + |
| + // The size of the requested large icon in pixels. |
| + int size_in_pixels_; |
| + |
| + // The index of the first character (relative to the path) where the the URL |
| + // from which the large icon is being requested is located. |
| + size_t path_index_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(LargeIconUrlParser); |
| +}; |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_COMMON_FAVICON_LARGE_ICON_URL_PARSER_H_ |