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

Unified Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2428383006: Decouple VR Shell DPR and CSS size from Physical Displays. (Closed)
Patch Set: Fix load-bearing debugging code ;) Created 4 years, 2 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: content/browser/web_contents/web_contents_view_android.cc
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index 0222bc629b44766fe282fe8df395257522a925a6..02a36a17a23c3e42cd5d37c5c7bd7d8ef81dd28e 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -28,10 +28,14 @@ using base::android::ScopedJavaLocalRef;
namespace content {
-// static
-void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
- const display::Display& display =
- display::Screen::GetScreen()->GetPrimaryDisplay();
+namespace {
+
+void GetScreenInfoForWindow(ScreenInfo* results,
+ ui::ViewAndroid* window) {
+ display::Screen* screen = display::Screen::GetScreen();
+ const display::Display display = window
+ ? screen->GetDisplayNearestWindow(window)
+ : screen->GetPrimaryDisplay();
results->rect = display.bounds();
// TODO(husky): Remove any system controls from availableRect.
results->available_rect = display.work_area();
@@ -45,6 +49,13 @@ void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
results->is_monochrome = display.is_monochrome();
}
+} // namespace
+
+// static
+void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
+ GetScreenInfoForWindow(results, nullptr);
+}
+
WebContentsView* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
@@ -104,8 +115,7 @@ gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const {
}
void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const {
- // ScreenInfo isn't tied to the widget on Android. Always return the default.
- WebContentsView::GetDefaultScreenInfo(result);
+ GetScreenInfoForWindow(result, GetNativeView());
}
void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const {

Powered by Google App Engine
This is Rietveld 408576698