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

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

Issue 2891333002: Introduce dedicated enum value for icons from Web Manifests (Closed)
Patch Set: Put browsertest behind #if. Created 3 years, 7 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/location.h" 10 #include "base/location.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 void AddToHomescreenDataFetcher::FetchFavicon() { 259 void AddToHomescreenDataFetcher::FetchFavicon() {
260 if (!web_contents() || !weak_observer_) 260 if (!web_contents() || !weak_observer_)
261 return; 261 return;
262 262
263 // Grab the best, largest icon we can find to represent this bookmark. 263 // Grab the best, largest icon we can find to represent this bookmark.
264 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its 264 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its
265 // rewrite is further along. 265 // rewrite is further along.
266 std::vector<int> icon_types{ 266 std::vector<int> icon_types{
267 favicon_base::FAVICON, 267 favicon_base::WEB_MANIFEST_ICON, favicon_base::FAVICON,
268 favicon_base::TOUCH_PRECOMPOSED_ICON | favicon_base::TOUCH_ICON}; 268 favicon_base::TOUCH_PRECOMPOSED_ICON | favicon_base::TOUCH_ICON};
269 269
270 favicon::FaviconService* favicon_service = 270 favicon::FaviconService* favicon_service =
271 FaviconServiceFactory::GetForProfile( 271 FaviconServiceFactory::GetForProfile(
272 Profile::FromBrowserContext(web_contents()->GetBrowserContext()), 272 Profile::FromBrowserContext(web_contents()->GetBrowserContext()),
273 ServiceAccessType::EXPLICIT_ACCESS); 273 ServiceAccessType::EXPLICIT_ACCESS);
274 274
275 // Using favicon if its size is not smaller than platform required size, 275 // Using favicon if its size is not smaller than platform required size,
276 // otherwise using the largest icon among all avaliable icons. 276 // otherwise using the largest icon among all avaliable icons.
277 int threshold_to_get_any_largest_icon = ideal_icon_size_in_px_ - 1; 277 int threshold_to_get_any_largest_icon = ideal_icon_size_in_px_ - 1;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) { 339 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& primary_icon) {
340 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 340 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
341 if (!web_contents() || !weak_observer_ || is_icon_saved_) 341 if (!web_contents() || !weak_observer_ || is_icon_saved_)
342 return; 342 return;
343 343
344 is_icon_saved_ = true; 344 is_icon_saved_ = true;
345 primary_icon_ = primary_icon; 345 primary_icon_ = primary_icon;
346 is_ready_ = true; 346 is_ready_ = true;
347 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_); 347 weak_observer_->OnDataAvailable(shortcut_info_, primary_icon_, badge_icon_);
348 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698