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

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

Issue 2156113002: Replace AppBannerDataFetcher with InstallableManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-refactor
Patch Set: Naming, includes Created 4 years, 4 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/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
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager_emulation.h ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698