Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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_) |
| 213 return; | 213 return; |
| 214 | 214 |
| 215 if (is_installable_check_complete_) | |
|
dominickn
2017/02/28 23:17:12
Combine the two conditionals:
if (!web_contents()
F
2017/02/28 23:22:06
Done.
| |
| 216 return; | |
| 217 | |
| 215 is_installable_check_complete_ = true; | 218 is_installable_check_complete_ = true; |
| 216 | 219 |
| 217 bool webapk_compatible = false; | 220 bool webapk_compatible = false; |
| 218 if (check_webapk_compatibility_) { | 221 if (check_webapk_compatibility_) { |
| 219 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && | 222 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && |
| 220 AreWebManifestUrlsWebApkCompatible(data.manifest)); | 223 AreWebManifestUrlsWebApkCompatible(data.manifest)); |
| 221 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); | 224 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); |
| 222 | 225 |
| 223 if (webapk_compatible) { | 226 if (webapk_compatible) { |
| 224 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag | 227 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { | 347 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { |
| 345 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 348 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 346 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 349 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
| 347 return; | 350 return; |
| 348 | 351 |
| 349 is_icon_saved_ = true; | 352 is_icon_saved_ = true; |
| 350 primary_icon_ = primary_icon; | 353 primary_icon_ = primary_icon; |
| 351 is_ready_ = true; | 354 is_ready_ = true; |
| 352 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); | 355 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); |
| 353 } | 356 } |
| OLD | NEW |