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 "chrome/browser/banners/app_banner_data_fetcher.h" | 5 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 OnHasServiceWorker(web_contents); | 335 OnHasServiceWorker(web_contents); |
336 } | 336 } |
337 | 337 |
338 void AppBannerDataFetcher::OnHasServiceWorker( | 338 void AppBannerDataFetcher::OnHasServiceWorker( |
339 content::WebContents* web_contents) { | 339 content::WebContents* web_contents) { |
340 GURL icon_url = | 340 GURL icon_url = |
341 ManifestIconSelector::FindBestMatchingIcon( | 341 ManifestIconSelector::FindBestMatchingIcon( |
342 web_app_data_.icons, | 342 web_app_data_.icons, |
343 ideal_icon_size_in_dp_, | 343 ideal_icon_size_in_dp_, |
344 minimum_icon_size_in_dp_, | 344 minimum_icon_size_in_dp_, |
345 gfx::Screen::GetScreenFor(web_contents->GetNativeView())); | 345 gfx::Screen::GetScreen()); |
346 | 346 |
347 if (!FetchAppIcon(web_contents, icon_url)) { | 347 if (!FetchAppIcon(web_contents, icon_url)) { |
348 OutputDeveloperNotShownMessage(web_contents, kCannotDetermineBestIcon); | 348 OutputDeveloperNotShownMessage(web_contents, kCannotDetermineBestIcon); |
349 Cancel(); | 349 Cancel(); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, | 353 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, |
354 const GURL& icon_url) { | 354 const GURL& icon_url) { |
355 return ManifestIconDownloader::Download( | 355 return ManifestIconDownloader::Download( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return false; | 447 return false; |
448 } | 448 } |
449 if (!DoesManifestContainRequiredIcon(manifest)) { | 449 if (!DoesManifestContainRequiredIcon(manifest)) { |
450 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); | 450 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); |
451 return false; | 451 return false; |
452 } | 452 } |
453 return true; | 453 return true; |
454 } | 454 } |
455 | 455 |
456 } // namespace banners | 456 } // namespace banners |
OLD | NEW |