| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 is_debug_mode_); | 337 is_debug_mode_); |
| 338 Cancel(); | 338 Cancel(); |
| 339 return; | 339 return; |
| 340 } | 340 } |
| 341 | 341 |
| 342 OnHasServiceWorker(web_contents); | 342 OnHasServiceWorker(web_contents); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void AppBannerDataFetcher::OnHasServiceWorker( | 345 void AppBannerDataFetcher::OnHasServiceWorker( |
| 346 content::WebContents* web_contents) { | 346 content::WebContents* web_contents) { |
| 347 GURL icon_url = | 347 GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( |
| 348 ManifestIconSelector::FindBestMatchingIcon( | 348 web_app_data_.icons, ideal_icon_size_in_dp_, minimum_icon_size_in_dp_); |
| 349 web_app_data_.icons, | |
| 350 ideal_icon_size_in_dp_, | |
| 351 minimum_icon_size_in_dp_, | |
| 352 gfx::Screen::GetScreenFor(web_contents->GetNativeView())); | |
| 353 | 349 |
| 354 if (!FetchAppIcon(web_contents, icon_url)) { | 350 if (!FetchAppIcon(web_contents, icon_url)) { |
| 355 OutputDeveloperNotShownMessage(web_contents, kCannotDetermineBestIcon, | 351 OutputDeveloperNotShownMessage(web_contents, kCannotDetermineBestIcon, |
| 356 is_debug_mode_); | 352 is_debug_mode_); |
| 357 Cancel(); | 353 Cancel(); |
| 358 } | 354 } |
| 359 } | 355 } |
| 360 | 356 |
| 361 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, | 357 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, |
| 362 const GURL& icon_url) { | 358 const GURL& icon_url) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 456 } |
| 461 if (!DoesManifestContainRequiredIcon(manifest)) { | 457 if (!DoesManifestContainRequiredIcon(manifest)) { |
| 462 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, | 458 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, |
| 463 is_debug_mode); | 459 is_debug_mode); |
| 464 return false; | 460 return false; |
| 465 } | 461 } |
| 466 return true; | 462 return true; |
| 467 } | 463 } |
| 468 | 464 |
| 469 } // namespace banners | 465 } // namespace banners |
| OLD | NEW |