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/core/large_icon_service.h" | 5 #include "components/favicon/core/large_icon_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/gfx/codec/png_codec.h" | 25 #include "ui/gfx/codec/png_codec.h" |
26 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
27 #include "url/url_canon.h" | 27 #include "url/url_canon.h" |
28 | 28 |
29 namespace favicon { | 29 namespace favicon { |
30 namespace { | 30 namespace { |
31 | 31 |
32 const char kGoogleServerV2RequestFormat[] = | 32 const char kGoogleServerV2RequestFormat[] = |
33 "https://t0.gstatic.com/faviconV2?" | 33 "https://t0.gstatic.com/faviconV2?" |
34 "client=chrome&drop_404_icon=true&size=%d&min_size=%d&max_size=%d&" | 34 "client=chrome&drop_404_icon=true&size=%d&min_size=%d&max_size=%d&" |
35 "fallback_opts=TYPE,SIZE&url=%s"; | 35 "fallback_opts=TYPE,SIZE,URL&url=%s"; |
36 const int kGoogleServerV2MaxSizeInPixel = 128; | 36 const int kGoogleServerV2MaxSizeInPixel = 128; |
37 const int kGoogleServerV2DesiredSizeInPixel = 64; | 37 const int kGoogleServerV2DesiredSizeInPixel = 64; |
38 | 38 |
39 GURL TrimPageUrlForGoogleServer(const GURL& page_url) { | 39 GURL TrimPageUrlForGoogleServer(const GURL& page_url) { |
40 if (!page_url.SchemeIsHTTPOrHTTPS() || page_url.HostIsIPAddress()) | 40 if (!page_url.SchemeIsHTTPOrHTTPS() || page_url.HostIsIPAddress()) |
41 return GURL(); | 41 return GURL(); |
42 | 42 |
43 url::Replacements<char> replacements; | 43 url::Replacements<char> replacements; |
44 replacements.ClearUsername(); | 44 replacements.ClearUsername(); |
45 replacements.ClearPassword(); | 45 replacements.ClearPassword(); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // TODO(beaudoin): For now this is just a wrapper around | 333 // TODO(beaudoin): For now this is just a wrapper around |
334 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 334 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
335 // possible large icon. Also add logic to fetch-on-demand when the URL of | 335 // possible large icon. Also add logic to fetch-on-demand when the URL of |
336 // a large icon is known but its bitmap is not available. | 336 // a large icon is known but its bitmap is not available. |
337 return favicon_service_->GetLargestRawFaviconForPageURL( | 337 return favicon_service_->GetLargestRawFaviconForPageURL( |
338 page_url, large_icon_types_, min_source_size_in_pixel, | 338 page_url, large_icon_types_, min_source_size_in_pixel, |
339 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 339 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
340 } | 340 } |
341 | 341 |
342 } // namespace favicon | 342 } // namespace favicon |
OLD | NEW |