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

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

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Version of patch without second test. 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 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 36ce67bbc77de8acaaf77fe3d59c84b13b20f2e7..33e714ea869ec8b75d5aead4c2d1ee9e479fba31 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -16,6 +16,9 @@
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/drop_data.h"
+#include "third_party/WebKit/public/platform/WebScreenInfo.h"
+#include "ui/display/screen.h"
+#include "ui/gfx/android/device_display_info.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/image/image_skia.h"
@@ -26,6 +29,24 @@ using base::android::ScopedJavaLocalRef;
namespace content {
+// static
+void WebContentsView::GetDefaultScreenInfo(
+ blink::WebScreenInfo* results) {
+ const display::Display& display =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
+ results->rect = display.bounds();
+ // TODO(husky): Remove any system controls from availableRect.
+ results->availableRect = display.work_area();
+ results->deviceScaleFactor = display.device_scale_factor();
+ results->orientationAngle = display.RotationAsDegree();
+ results->orientationType =
+ RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
+ gfx::DeviceDisplayInfo info;
+ results->depth = display.color_depth();
+ results->depthPerComponent = display.depth_per_component();
+ results->isMonochrome = (results->depthPerComponent == 0);
+}
+
WebContentsView* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
@@ -84,6 +105,11 @@ gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const {
return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr;
}
+void WebContentsViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) const {
+ // ScreenInfo isn't tied to the widget on Android. Always return the default.
+ WebContentsView::GetDefaultScreenInfo(result);
+}
+
void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const {
*out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize())
: gfx::Rect();
« no previous file with comments | « content/browser/web_contents/web_contents_view_android.h ('k') | content/browser/web_contents/web_contents_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698