| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 content::Manifest::Icon::IconPurpose::ANY); | 243 content::Manifest::Icon::IconPurpose::ANY); |
| 244 shortcut_info_.ideal_splash_image_size_in_px = ideal_splash_image_size_in_px_; | 244 shortcut_info_.ideal_splash_image_size_in_px = ideal_splash_image_size_in_px_; |
| 245 shortcut_info_.minimum_splash_image_size_in_px = | 245 shortcut_info_.minimum_splash_image_size_in_px = |
| 246 minimum_splash_image_size_in_px_; | 246 minimum_splash_image_size_in_px_; |
| 247 | 247 |
| 248 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title); | 248 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title); |
| 249 | 249 |
| 250 if (data.primary_icon) { | 250 if (data.primary_icon) { |
| 251 shortcut_info_.best_primary_icon_url = data.primary_icon_url; | 251 shortcut_info_.best_primary_icon_url = data.primary_icon_url; |
| 252 | 252 |
| 253 CreateLauncherIcon(*(data.primary_icon)); | 253 if (webapk_compatible) |
| 254 NotifyObserver(*data.primary_icon); |
| 255 else |
| 256 CreateLauncherIcon(*(data.primary_icon)); |
| 254 return; | 257 return; |
| 255 } | 258 } |
| 256 | 259 |
| 257 FetchFavicon(); | 260 FetchFavicon(); |
| 258 } | 261 } |
| 259 | 262 |
| 260 void AddToHomescreenDataFetcher::FetchFavicon() { | 263 void AddToHomescreenDataFetcher::FetchFavicon() { |
| 261 if (!web_contents() || !weak_observer_) | 264 if (!web_contents() || !weak_observer_) |
| 262 return; | 265 return; |
| 263 | 266 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { | 343 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { |
| 341 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 344 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 342 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 345 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
| 343 return; | 346 return; |
| 344 | 347 |
| 345 is_icon_saved_ = true; | 348 is_icon_saved_ = true; |
| 346 primary_icon_ = primary_icon; | 349 primary_icon_ = primary_icon; |
| 347 is_ready_ = true; | 350 is_ready_ = true; |
| 348 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); | 351 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); |
| 349 } | 352 } |
| OLD | NEW |