| 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/android/webapps/add_to_homescreen_data_fetcher.h" | 5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (!is_icon_saved_) { | 202 if (!is_icon_saved_) { |
| 203 badge_icon_.reset(); | 203 badge_icon_.reset(); |
| 204 CreateLauncherIcon(SkBitmap()); | 204 CreateLauncherIcon(SkBitmap()); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck( | 208 void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck( |
| 209 const InstallableData& data) { | 209 const InstallableData& data) { |
| 210 badge_icon_.reset(); | 210 badge_icon_.reset(); |
| 211 | 211 |
| 212 if (!web_contents() || !weak_observer_) | 212 if (!web_contents() || !weak_observer_ || is_installable_check_complete_) |
| 213 return; | 213 return; |
| 214 | 214 |
| 215 is_installable_check_complete_ = true; | 215 is_installable_check_complete_ = true; |
| 216 | 216 |
| 217 bool webapk_compatible = false; | 217 bool webapk_compatible = false; |
| 218 if (check_webapk_compatibility_) { | 218 if (check_webapk_compatibility_) { |
| 219 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && | 219 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && |
| 220 AreWebManifestUrlsWebApkCompatible(data.manifest)); | 220 AreWebManifestUrlsWebApkCompatible(data.manifest)); |
| 221 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); | 221 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); |
| 222 | 222 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { | 344 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { |
| 345 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 345 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 346 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 346 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
| 347 return; | 347 return; |
| 348 | 348 |
| 349 is_icon_saved_ = true; | 349 is_icon_saved_ = true; |
| 350 primary_icon_ = primary_icon; | 350 primary_icon_ = primary_icon; |
| 351 is_ready_ = true; | 351 is_ready_ = true; |
| 352 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); | 352 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); |
| 353 } | 353 } |
| OLD | NEW |