OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "components/favicon/content/favicon_url_util.h" | 5 #include "components/favicon/content/favicon_url_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "components/favicon/core/favicon_url.h" | 10 #include "components/favicon/core/favicon_url.h" |
11 #include "components/favicon_base/favicon_types.h" | 11 #include "components/favicon_base/favicon_types.h" |
12 #include "content/public/common/favicon_url.h" | 12 #include "content/public/common/favicon_url.h" |
13 | 13 |
14 namespace favicon { | 14 namespace favicon { |
15 namespace { | 15 namespace { |
16 | 16 |
17 favicon_base::IconType IconTypeFromContentIconType( | 17 favicon_base::IconType IconTypeFromContentIconType( |
18 content::FaviconURL::IconType icon_type) { | 18 content::FaviconURL::IconType icon_type) { |
19 switch (icon_type) { | 19 switch (icon_type) { |
20 case content::FaviconURL::FAVICON: | 20 case content::FaviconURL::IconType::kFavicon: |
21 return favicon_base::FAVICON; | 21 return favicon_base::FAVICON; |
22 case content::FaviconURL::TOUCH_ICON: | 22 case content::FaviconURL::IconType::kTouchIcon: |
23 return favicon_base::TOUCH_ICON; | 23 return favicon_base::TOUCH_ICON; |
24 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: | 24 case content::FaviconURL::IconType::kTouchPrecomposedIcon: |
25 return favicon_base::TOUCH_PRECOMPOSED_ICON; | 25 return favicon_base::TOUCH_PRECOMPOSED_ICON; |
26 case content::FaviconURL::INVALID_ICON: | 26 case content::FaviconURL::IconType::kInvalid: |
27 return favicon_base::INVALID_ICON; | 27 return favicon_base::INVALID_ICON; |
28 } | 28 } |
29 NOTREACHED(); | 29 NOTREACHED(); |
30 return favicon_base::INVALID_ICON; | 30 return favicon_base::INVALID_ICON; |
31 } | 31 } |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 FaviconURL FaviconURLFromContentFaviconURL( | 35 FaviconURL FaviconURLFromContentFaviconURL( |
36 const content::FaviconURL& favicon_url) { | 36 const content::FaviconURL& favicon_url) { |
37 return FaviconURL(favicon_url.icon_url, | 37 return FaviconURL(favicon_url.icon_url, |
38 IconTypeFromContentIconType(favicon_url.icon_type), | 38 IconTypeFromContentIconType(favicon_url.icon_type), |
39 favicon_url.icon_sizes); | 39 favicon_url.icon_sizes); |
40 } | 40 } |
41 | 41 |
42 std::vector<FaviconURL> FaviconURLsFromContentFaviconURLs( | 42 std::vector<FaviconURL> FaviconURLsFromContentFaviconURLs( |
43 const std::vector<content::FaviconURL>& favicon_urls) { | 43 const std::vector<content::FaviconURL>& favicon_urls) { |
44 std::vector<FaviconURL> result; | 44 std::vector<FaviconURL> result; |
45 result.reserve(favicon_urls.size()); | 45 result.reserve(favicon_urls.size()); |
46 std::transform(favicon_urls.begin(), favicon_urls.end(), | 46 std::transform(favicon_urls.begin(), favicon_urls.end(), |
47 std::back_inserter(result), FaviconURLFromContentFaviconURL); | 47 std::back_inserter(result), FaviconURLFromContentFaviconURL); |
48 return result; | 48 return result; |
49 } | 49 } |
50 | 50 |
51 } // namespace favicon | 51 } // namespace favicon |
OLD | NEW |