| 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_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 | 347 |
| 348 void AppBannerDataFetcher::OnHasServiceWorker( | 348 void AppBannerDataFetcher::OnHasServiceWorker( |
| 349 content::WebContents* web_contents) { | 349 content::WebContents* web_contents) { |
| 350 GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( | 350 GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( |
| 351 web_app_data_.icons, ideal_icon_size_in_dp_, minimum_icon_size_in_dp_); | 351 web_app_data_.icons, ideal_icon_size_in_dp_, minimum_icon_size_in_dp_); |
| 352 | 352 |
| 353 if (icon_url.is_empty()) { | 353 if (icon_url.is_empty()) { |
| 354 OutputDeveloperNotShownMessage( | 354 OutputDeveloperNotShownMessage( |
| 355 web_contents, | 355 web_contents, |
| 356 kNoIconMatchingRequirements, |
| 356 base::IntToString(ManifestIconSelector::ConvertIconSizeFromDpToPx( | 357 base::IntToString(ManifestIconSelector::ConvertIconSizeFromDpToPx( |
| 357 minimum_icon_size_in_dp_)) + | 358 minimum_icon_size_in_dp_)), |
| 358 kNoIconMatchingRequirements, | |
| 359 is_debug_mode_); | 359 is_debug_mode_); |
| 360 Cancel(); | 360 Cancel(); |
| 361 } else if (!FetchAppIcon(web_contents, icon_url)) { | 361 } else if (!FetchAppIcon(web_contents, icon_url)) { |
| 362 OutputDeveloperNotShownMessage(web_contents, kCannotDownloadIcon, | 362 OutputDeveloperNotShownMessage(web_contents, kCannotDownloadIcon, |
| 363 is_debug_mode_); | 363 is_debug_mode_); |
| 364 Cancel(); | 364 Cancel(); |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, | 368 bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 465 } |
| 466 if (!DoesManifestContainRequiredIcon(manifest)) { | 466 if (!DoesManifestContainRequiredIcon(manifest)) { |
| 467 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, | 467 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, |
| 468 is_debug_mode); | 468 is_debug_mode); |
| 469 return false; | 469 return false; |
| 470 } | 470 } |
| 471 return true; | 471 return true; |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace banners | 474 } // namespace banners |
| OLD | NEW |