Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: chrome/common/favicon/fallback_icon_url_parser.h

Issue 924063003: [Favicon] Adding FallbackIconUrlParser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unsigned int compare issue in test. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/favicon/fallback_icon_url_parser.h
diff --git a/chrome/common/favicon/fallback_icon_url_parser.h b/chrome/common/favicon/fallback_icon_url_parser.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5ea043a7eb8509bc21bc8411e2da23d054e1d58
--- /dev/null
+++ b/chrome/common/favicon/fallback_icon_url_parser.h
@@ -0,0 +1,45 @@
+// 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_FALLBACK_ICON_URL_PARSER_H_
+#define CHROME_COMMON_FAVICON_FALLBACK_ICON_URL_PARSER_H_
+
+#include <string>
+
+#include "components/favicon_base/fallback_icon_style.h"
+#include "third_party/skia/include/core/SkColor.h"
cpu_(ooo_6.6-7.5) 2015/02/19 03:49:19 can you use a fwd decl instead of #include ?
huangs 2015/02/20 16:06:45 SkColor is a typedef: typedef uint32_t SkColor;
+
+namespace chrome {
+
+struct ParsedFallbackIconPath {
+ // The page URL the fallback icon is requested for.
+ std::string url;
cpu_(ooo_6.6-7.5) 2015/02/19 03:49:19 we usually don't have strings doing url jobs. use
huangs 2015/02/20 16:06:45 I'm following the style of the matching file favic
+
+ // The size of the requested fallback icon in pixels.
+ int size_in_pixels;
cpu_(ooo_6.6-7.5) 2015/02/19 03:49:18 can you have a negative size? if not use size_t or
huangs 2015/02/20 16:06:45 Will use size_t.
huangs 2015/02/20 20:39:32 On second thought, this is int because all favicon
+
+ // Styling specifications of fallback icon.
+ favicon_base::FallbackIconStyle style;
+};
+
+// Parses a color in "RGB", "RRGGBB", or "RRGGBBAA" format. Returns true on
+// success.
+bool ParseIconColor(const std::string& str, SkColor* color);
cpu_(ooo_6.6-7.5) 2015/02/19 03:49:18 this function seems out of place, also |str| shoul
huangs 2015/02/20 16:06:45 How about using SkParse::FindColor()? It will chan
+
+
+// Parses |specs_str|, which should be the comma-separated value portion
+// in the format described at the top of the file
+// "chrome/browser/ui/webui/fallback_icon_source.h".
+bool ParseFallbackIconSpecs(const std::string& specs_str,
+ int *size,
+ favicon_base::FallbackIconStyle* style);
cpu_(ooo_6.6-7.5) 2015/02/19 03:49:18 you seem to be returning 2 of the 3 items in Parse
huangs 2015/02/20 16:06:45 Will take the latter case. I suppose specific uni
+
+// Parses |path|, which should be in the format described at the top of the
+// file "chrome/browser/ui/webui/fallback_icon_source.h".
+bool ParseFallbackIconPath(const std::string& path,
+ ParsedFallbackIconPath* parsed);
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_FAVICON_FALLBACK_ICON_URL_PARSER_H_

Powered by Google App Engine
This is Rietveld 408576698