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/location.h" | 10 #include "base/location.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 bool check_webapk_compatibility, | 74 bool check_webapk_compatibility, |
| 75 Observer* observer) | 75 Observer* observer) |
| 76 : WebContentsObserver(web_contents), | 76 : WebContentsObserver(web_contents), |
| 77 background_task_runner_( | 77 background_task_runner_( |
| 78 content::BrowserThread::GetBlockingPool() | 78 content::BrowserThread::GetBlockingPool() |
| 79 ->GetTaskRunnerWithShutdownBehavior( | 79 ->GetTaskRunnerWithShutdownBehavior( |
| 80 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), | 80 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), |
| 81 weak_observer_(observer), | 81 weak_observer_(observer), |
| 82 shortcut_info_(GetShortcutUrl(web_contents->GetBrowserContext(), | 82 shortcut_info_(GetShortcutUrl(web_contents->GetBrowserContext(), |
| 83 web_contents->GetLastCommittedURL())), | 83 web_contents->GetLastCommittedURL())), |
| 84 data_timeout_timer_(false, false), | |
| 85 ideal_icon_size_in_px_(ideal_icon_size_in_px), | 84 ideal_icon_size_in_px_(ideal_icon_size_in_px), |
| 86 minimum_icon_size_in_px_(minimum_icon_size_in_px), | 85 minimum_icon_size_in_px_(minimum_icon_size_in_px), |
| 87 ideal_splash_image_size_in_px_(ideal_splash_image_size_in_px), | 86 ideal_splash_image_size_in_px_(ideal_splash_image_size_in_px), |
| 88 minimum_splash_image_size_in_px_(minimum_splash_image_size_in_px), | 87 minimum_splash_image_size_in_px_(minimum_splash_image_size_in_px), |
| 89 badge_size_in_px_(badge_size_in_px), | 88 badge_size_in_px_(badge_size_in_px), |
| 90 check_webapk_compatibility_(check_webapk_compatibility), | 89 check_webapk_compatibility_(check_webapk_compatibility), |
| 91 is_waiting_for_web_application_info_(true), | 90 is_waiting_for_web_application_info_(true), |
| 92 is_installable_check_complete_(false), | 91 is_installable_check_complete_(false), |
| 93 is_icon_saved_(false), | 92 is_icon_saved_(false), |
| 94 is_ready_(false) { | 93 is_ready_(false) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 | 198 |
| 200 void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck( | 199 void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck( |
| 201 const InstallableData& data) { | 200 const InstallableData& data) { |
| 202 badge_icon_.reset(); | 201 badge_icon_.reset(); |
| 203 | 202 |
| 204 if (!web_contents() || !weak_observer_ || is_installable_check_complete_) | 203 if (!web_contents() || !weak_observer_ || is_installable_check_complete_) |
| 205 return; | 204 return; |
| 206 | 205 |
| 207 is_installable_check_complete_ = true; | 206 is_installable_check_complete_ = true; |
| 208 | 207 |
| 208 data_timeout_timer_.Stop(); | |
|
dominickn
2017/03/23 22:37:35
Move this to be the first thing in this method (ot
F
2017/03/24 02:27:11
Done.
| |
| 209 | |
| 209 bool webapk_compatible = false; | 210 bool webapk_compatible = false; |
| 210 if (check_webapk_compatibility_) { | 211 if (check_webapk_compatibility_) { |
| 211 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && | 212 webapk_compatible = (data.error_code == NO_ERROR_DETECTED && |
| 212 AreWebManifestUrlsWebApkCompatible(data.manifest)); | 213 AreWebManifestUrlsWebApkCompatible(data.manifest)); |
| 213 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); | 214 weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible); |
| 214 | 215 |
| 215 if (webapk_compatible) { | 216 if (webapk_compatible) { |
| 216 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag | 217 // WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag |
| 217 // data received in OnDidGetWebApplicationInfo(). | 218 // data received in OnDidGetWebApplicationInfo(). |
| 218 shortcut_info_ = ShortcutInfo(GURL()); | 219 shortcut_info_ = ShortcutInfo(GURL()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { | 340 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { |
| 340 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 341 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 341 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 342 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
| 342 return; | 343 return; |
| 343 | 344 |
| 344 is_icon_saved_ = true; | 345 is_icon_saved_ = true; |
| 345 primary_icon_ = primary_icon; | 346 primary_icon_ = primary_icon; |
| 346 is_ready_ = true; | 347 is_ready_ = true; |
| 347 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); | 348 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); |
| 348 } | 349 } |
| OLD | NEW |