| 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 12 matching lines...) Expand all Loading... |
| 23 #include "components/favicon_base/favicon_util.h" | 23 #include "components/favicon_base/favicon_util.h" |
| 24 #include "skia/ext/image_operations.h" | 24 #include "skia/ext/image_operations.h" |
| 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/" | 33 "https://t0.gstatic.com/faviconV2?" |
| 34 "faviconV2?user=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&url=%s"; | 35 "fallback_opts=TYPE,SIZE&url=%s"; |
| 36 const int kGoogleServerV2MaxSizeInPixel = 256; | 36 const int kGoogleServerV2MaxSizeInPixel = 128; |
| 37 const int kGoogleServerV2DesiredSizeInPixel = 192; | 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(); |
| 46 replacements.ClearQuery(); | 46 replacements.ClearQuery(); |
| 47 replacements.ClearRef(); | 47 replacements.ClearRef(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 image_fetcher_->SetDataUseServiceName( | 288 image_fetcher_->SetDataUseServiceName( |
| 289 data_use_measurement::DataUseUserData::LARGE_ICON_SERVICE); | 289 data_use_measurement::DataUseUserData::LARGE_ICON_SERVICE); |
| 290 image_fetcher_->StartOrQueueNetworkRequest( | 290 image_fetcher_->StartOrQueueNetworkRequest( |
| 291 icon_url.spec(), icon_url, | 291 icon_url.spec(), icon_url, |
| 292 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_, | 292 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_, |
| 293 page_url, callback)); | 293 page_url, callback)); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace favicon | 296 } // namespace favicon |
| OLD | NEW |