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

Side by Side Diff: chrome/browser/banners/app_banner_manager_emulation.cc

Issue 1950133009: DevTools: account for the display scale factor while validating manifest under emulation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment addressed 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/banners/app_banner_manager_emulation.h"
6
7 #include "base/command_line.h"
8 #include "build/build_config.h"
9 #include "chrome/browser/banners/app_banner_data_fetcher_desktop.h"
10 #include "ui/display/screen.h"
11
12 namespace {
13
14 // We need to provide web developers with the guidance on the minimum icon
15 // size they should list in the manifest. Since the size depends on the
16 // device, we pick the baseline being a Nexus 5X-alike device.
17 // We make it clear in the 'add to home screen' emulation UI that the
18 // size does not correspond to the currently emulated device, but rather is
19 // a generic baseline.
20 const int kMinimumIconSize = 144;
21
22 } // anonymous namespace
23
24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerEmulation);
25
26 namespace banners {
27
28 AppBannerDataFetcher* AppBannerManagerEmulation::CreateAppBannerDataFetcher(
29 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate,
30 bool is_debug_mode) {
31
32 // Divide by the current screen density as the data fetcher will multiply
33 // it back in when trying to fetch an appropriate icon
34 int size = kMinimumIconSize / display::Screen::GetScreen()->
35 GetPrimaryDisplay().device_scale_factor();
36
37 return new AppBannerDataFetcherDesktop(web_contents(), weak_delegate,
38 size, size, is_debug_mode);
39 }
40
41 AppBannerManagerEmulation::AppBannerManagerEmulation(
42 content::WebContents* web_contents)
43 : AppBannerManager(web_contents) {
44 }
45
46 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698