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

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

Issue 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/task/cancelable_task_tracker.h" 11 #include "base/task/cancelable_task_tracker.h"
12 #include "chrome/browser/android/offline_pages/offline_page_utils.h" 12 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
13 #include "chrome/browser/android/shortcut_helper.h" 13 #include "chrome/browser/android/shortcut_helper.h"
14 #include "chrome/browser/favicon/favicon_service_factory.h" 14 #include "chrome/browser/favicon/favicon_service_factory.h"
15 #include "chrome/browser/manifest/manifest_icon_downloader.h" 15 #include "chrome/browser/manifest/manifest_icon_downloader.h"
16 #include "chrome/browser/manifest/manifest_icon_selector.h" 16 #include "chrome/browser/manifest/manifest_icon_selector.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/render_messages.h" 19 #include "chrome/common/render_messages.h"
20 #include "chrome/common/web_application_info.h" 20 #include "chrome/common/web_application_info.h"
21 #include "components/dom_distiller/core/url_utils.h" 21 #include "components/dom_distiller/core/url_utils.h"
22 #include "components/favicon/core/favicon_service.h" 22 #include "components/favicon/core/favicon_service.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_contents_observer.h" 26 #include "content/public/browser/web_contents_observer.h"
27 #include "content/public/common/frame_navigate_params.h" 27 #include "content/public/common/frame_navigate_params.h"
28 #include "content/public/common/manifest.h" 28 #include "content/public/common/manifest.h"
29 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 29 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
30 #include "ui/display/screen.h"
30 #include "ui/gfx/codec/png_codec.h" 31 #include "ui/gfx/codec/png_codec.h"
31 #include "ui/gfx/favicon_size.h" 32 #include "ui/gfx/favicon_size.h"
32 #include "ui/gfx/screen.h"
33 #include "url/gurl.h" 33 #include "url/gurl.h"
34 34
35 using content::Manifest; 35 using content::Manifest;
36 36
37 AddToHomescreenDataFetcher::AddToHomescreenDataFetcher( 37 AddToHomescreenDataFetcher::AddToHomescreenDataFetcher(
38 content::WebContents* web_contents, 38 content::WebContents* web_contents,
39 int ideal_icon_size_in_dp, 39 int ideal_icon_size_in_dp,
40 int minimum_icon_size_in_dp, 40 int minimum_icon_size_in_dp,
41 int ideal_splash_image_size_in_dp, 41 int ideal_splash_image_size_in_dp,
42 int minimum_splash_image_size_in_dp, 42 int minimum_splash_image_size_in_dp,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | 186 icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON |
187 favicon_base::TOUCH_ICON); 187 favicon_base::TOUCH_ICON);
188 favicon::FaviconService* favicon_service = 188 favicon::FaviconService* favicon_service =
189 FaviconServiceFactory::GetForProfile(profile, 189 FaviconServiceFactory::GetForProfile(profile,
190 ServiceAccessType::EXPLICIT_ACCESS); 190 ServiceAccessType::EXPLICIT_ACCESS);
191 191
192 // Using favicon if its size is not smaller than platform required size, 192 // Using favicon if its size is not smaller than platform required size,
193 // otherwise using the largest icon among all avaliable icons. 193 // otherwise using the largest icon among all avaliable icons.
194 int ideal_icon_size_in_px = 194 int ideal_icon_size_in_px =
195 ideal_icon_size_in_dp_ * 195 ideal_icon_size_in_dp_ *
196 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); 196 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor();
197 int threshold_to_get_any_largest_icon = ideal_icon_size_in_px - 1; 197 int threshold_to_get_any_largest_icon = ideal_icon_size_in_px - 1;
198 favicon_service->GetLargestRawFaviconForPageURL( 198 favicon_service->GetLargestRawFaviconForPageURL(
199 shortcut_info_.url, 199 shortcut_info_.url,
200 icon_types, 200 icon_types,
201 threshold_to_get_any_largest_icon, 201 threshold_to_get_any_largest_icon,
202 base::Bind(&AddToHomescreenDataFetcher::OnFaviconFetched, this), 202 base::Bind(&AddToHomescreenDataFetcher::OnFaviconFetched, this),
203 &favicon_task_tracker_); 203 &favicon_task_tracker_);
204 } 204 }
205 205
206 void AddToHomescreenDataFetcher::OnFaviconFetched( 206 void AddToHomescreenDataFetcher::OnFaviconFetched(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url); 270 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
271 271
272 // If URL points to an offline content, get original URL. 272 // If URL points to an offline content, get original URL.
273 GURL online_url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL( 273 GURL online_url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL(
274 web_contents()->GetBrowserContext(), original_url); 274 web_contents()->GetBrowserContext(), original_url);
275 if (online_url.is_valid()) 275 if (online_url.is_valid())
276 return online_url; 276 return online_url;
277 277
278 return original_url; 278 return original_url;
279 } 279 }
OLDNEW
« no previous file with comments | « chrome/browser/android/profiles/profile_downloader_android.cc ('k') | chrome/browser/banners/app_banner_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698