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/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 |
OLD | NEW |