1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/favicon/ios/favicon_url_util.h"
10 #include "components/favicon/core/favicon_url.h"
11 #include "components/favicon_base/favicon_types.h"
12 #include "ios/web/public/favicon_url.h"
17 favicon_base::IconType
IconTypeFromWebIconType(
18 web::FaviconURL::IconType icon_type
) {
20 case web::FaviconURL::FAVICON
:
21 return favicon_base::FAVICON
;
22 case web::FaviconURL::TOUCH_ICON
:
23 return favicon_base::TOUCH_ICON
;
24 case web::FaviconURL::TOUCH_PRECOMPOSED_ICON
:
25 return favicon_base::TOUCH_PRECOMPOSED_ICON
;
26 case web::FaviconURL::INVALID_ICON
:
27 return favicon_base::INVALID_ICON
;
30 return favicon_base::INVALID_ICON
;
35 FaviconURL
FaviconURLFromWebFaviconURL(
36 const web::FaviconURL
& favicon_url
) {
37 return FaviconURL(favicon_url
.icon_url
,
38 IconTypeFromWebIconType(favicon_url
.icon_type
),
39 favicon_url
.icon_sizes
);
42 std::vector
<FaviconURL
> FaviconURLsFromWebFaviconURLs(
43 const std::vector
<web::FaviconURL
>& favicon_urls
) {
44 std::vector
<FaviconURL
> result
;
45 result
.reserve(favicon_urls
.size());
46 std::transform(favicon_urls
.begin(), favicon_urls
.end(),
47 std::back_inserter(result
), FaviconURLFromWebFaviconURL
);
51 } // namespace favicon