OLD | NEW |
| (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/display.h" | |
11 #include "ui/display/screen.h" | |
12 | |
13 namespace { | |
14 | |
15 // We need to provide web developers with the guidance on the minimum icon | |
16 // size they should list in the manifest. Since the size depends on the | |
17 // device, we pick the baseline being a Nexus 5X-alike device. | |
18 // We make it clear in the 'add to home screen' emulation UI that the | |
19 // size does not correspond to the currently emulated device, but rather is | |
20 // a generic baseline. | |
21 const int kMinimumIconSize = 144; | |
22 | |
23 } // anonymous namespace | |
24 | |
25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerEmulation); | |
26 | |
27 namespace banners { | |
28 | |
29 AppBannerDataFetcher* AppBannerManagerEmulation::CreateAppBannerDataFetcher( | |
30 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate, | |
31 bool is_debug_mode) { | |
32 | |
33 // Divide by the current screen density as the data fetcher will multiply | |
34 // it back in when trying to fetch an appropriate icon | |
35 int size = kMinimumIconSize / display::Screen::GetScreen()-> | |
36 GetPrimaryDisplay().device_scale_factor(); | |
37 | |
38 return new AppBannerDataFetcherDesktop(web_contents(), weak_delegate, | |
39 size, size, is_debug_mode); | |
40 } | |
41 | |
42 AppBannerManagerEmulation::AppBannerManagerEmulation( | |
43 content::WebContents* web_contents) | |
44 : AppBannerManager(web_contents) { | |
45 } | |
46 | |
47 } // namespace banners | |
OLD | NEW |