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

Unified 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 added 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/banners/app_banner_manager_emulation.cc
diff --git a/chrome/browser/banners/app_banner_manager_emulation.cc b/chrome/browser/banners/app_banner_manager_emulation.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0a427490965d010c7c4d95ae4bf92fa36d1fec53
--- /dev/null
+++ b/chrome/browser/banners/app_banner_manager_emulation.cc
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/banners/app_banner_manager_emulation.h"
+
+#include "base/command_line.h"
+#include "build/build_config.h"
+#include "chrome/browser/banners/app_banner_data_fetcher_desktop.h"
+#include "ui/display/screen.h"
+
+namespace {
+
+// We need to provide web developers with the guidance on the minimum icon
+// size they should list in the manifest. Since the size depends on the
+// device, we pick the baseline being a Nexus 5X-alike device.
+// We make it clear in the 'add to home screen' emulation UI that the
dominickn 2016/05/06 18:29:47 Nit: It would be nice if it was also stated in the
pfeldman 2016/05/06 18:40:01 We'll get this messaging aligned with Jake.
+// size does not correspond to the currently emulated device, but rather is
+// a generic baseline.
+int kMinimumIconSize = 192;
dominickn 2016/05/06 18:29:47 I think this should be 144px - that has been the a
pfeldman 2016/05/06 18:40:01 Done.
+
+} // anonymous namespace
+
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerEmulation);
+
+namespace banners {
+
+AppBannerDataFetcher* AppBannerManagerEmulation::CreateAppBannerDataFetcher(
+ base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate,
+ bool is_debug_mode) {
+
dominickn 2016/05/06 18:29:46 Nit: add a comment along the lines of "Divide by t
pfeldman 2016/05/06 18:40:01 Done.
+ int size = kMinimumIconSize / display::Screen::GetScreen()->
+ GetPrimaryDisplay().device_scale_factor();
+
+ return new AppBannerDataFetcherDesktop(web_contents(), weak_delegate,
+ size, size, true);
dominickn 2016/05/06 18:29:46 Nit: pass through is_debug_mode for consistency.
pfeldman 2016/05/06 18:40:01 Done.
+}
+
+AppBannerManagerEmulation::AppBannerManagerEmulation(
+ content::WebContents* web_contents)
+ : AppBannerManager(web_contents) {
+}
+
+} // namespace banners

Powered by Google App Engine
This is Rietveld 408576698