| Index: content/browser/web_contents/web_contents_view_aura.cc
|
| diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
|
| index f426d94a08353978cb790a8e3a4fc122509bbdac..57b401c6aec46aebf1ab75acd067e7d25b795a47 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.cc
|
| +++ b/content/browser/web_contents/web_contents_view_aura.cc
|
| @@ -45,6 +45,7 @@
|
| #include "content/public/common/content_switches.h"
|
| #include "content/public/common/drop_data.h"
|
| #include "net/base/filename_util.h"
|
| +#include "third_party/WebKit/public/platform/WebScreenInfo.h"
|
| #include "third_party/WebKit/public/web/WebInputEvent.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/client/screen_position_client.h"
|
| @@ -625,6 +626,47 @@ gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {
|
| return window ? window : delegate_->GetNativeWindow();
|
| }
|
|
|
| +namespace {
|
| +
|
| +void GetScreenInfoForWindow(blink::WebScreenInfo* results,
|
| + aura::Window* window) {
|
| + display::Screen* screen = display::Screen::GetScreen();
|
| + const display::Display display = window
|
| + ? screen->GetDisplayNearestWindow(window)
|
| + : screen->GetPrimaryDisplay();
|
| + results->rect = display.bounds();
|
| + results->availableRect = display.work_area();
|
| + // TODO(derat|oshima): Don't hardcode this. Get this from display object.
|
| + results->depth = 24;
|
| + results->depthPerComponent = 8;
|
| + results->deviceScaleFactor = display.device_scale_factor();
|
| +
|
| + // The Display rotation and the WebScreenInfo orientation are not the same
|
| + // angle. The former is the physical display rotation while the later is the
|
| + // rotation required by the content to be shown properly on the screen, in
|
| + // other words, relative to the physical display.
|
| + results->orientationAngle = display.RotationAsDegree();
|
| + if (results->orientationAngle == 90)
|
| + results->orientationAngle = 270;
|
| + else if (results->orientationAngle == 270)
|
| + results->orientationAngle = 90;
|
| +
|
| + results->orientationType =
|
| + RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +// Static.
|
| +void WebContentsView::GetDefaultScreenInfo(blink::WebScreenInfo* results) {
|
| + GetScreenInfoForWindow(results, NULL);
|
| +}
|
| +
|
| +void WebContentsViewAura::GetScreenInfo(
|
| + blink::WebScreenInfo* web_screen_info) const {
|
| + GetScreenInfoForWindow(web_screen_info, window_.get());
|
| +}
|
| +
|
| void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const {
|
| *out = window_->GetBoundsInScreen();
|
| }
|
|
|