Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 2662103002: Refactor ManifestIconSelector and update it for Manifest.icon.purpose (Closed)
Patch Set: Addressing comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (!data.manifest.IsEmpty()) { 207 if (!data.manifest.IsEmpty()) {
208 content::RecordAction( 208 content::RecordAction(
209 base::UserMetricsAction("webapps.AddShortcut.Manifest")); 209 base::UserMetricsAction("webapps.AddShortcut.Manifest"));
210 shortcut_info_.UpdateFromManifest(data.manifest); 210 shortcut_info_.UpdateFromManifest(data.manifest);
211 shortcut_info_.manifest_url = data.manifest_url; 211 shortcut_info_.manifest_url = data.manifest_url;
212 } 212 }
213 213
214 // Save the splash screen URL for the later download. 214 // Save the splash screen URL for the later download.
215 splash_screen_url_ = ManifestIconSelector::FindBestMatchingIcon( 215 splash_screen_url_ = ManifestIconSelector::FindBestMatchingIcon(
216 data.manifest.icons, ideal_splash_image_size_in_px_, 216 data.manifest.icons, ideal_splash_image_size_in_px_,
217 minimum_splash_image_size_in_px_); 217 minimum_splash_image_size_in_px_,
218 content::Manifest::Icon::IconPurpose::ANY);
218 219
219 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title); 220 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title);
220 221
221 if (data.primary_icon) { 222 if (data.primary_icon) {
222 shortcut_info_.best_icon_url = data.primary_icon_url; 223 shortcut_info_.best_icon_url = data.primary_icon_url;
223 224
224 CreateLauncherIcon(*(data.primary_icon)); 225 CreateLauncherIcon(*(data.primary_icon));
225 return; 226 return;
226 } 227 }
227 228
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) { 313 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) {
313 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 314 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
314 if (!web_contents() || !weak_observer_ || is_icon_saved_) 315 if (!web_contents() || !weak_observer_ || is_icon_saved_)
315 return; 316 return;
316 317
317 is_icon_saved_ = true; 318 is_icon_saved_ = true;
318 shortcut_icon_ = icon; 319 shortcut_icon_ = icon;
319 is_ready_ = true; 320 is_ready_ = true;
320 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); 321 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_);
321 } 322 }
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager_android.cc ('k') | chrome/browser/installable/installable_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698