| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { | 299 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { |
| 300 const gfx::Display display = window ? | 300 const gfx::Display display = window ? |
| 301 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) : | 301 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) : |
| 302 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay(); | 302 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay(); |
| 303 results->rect = display.bounds(); | 303 results->rect = display.bounds(); |
| 304 results->availableRect = display.work_area(); | 304 results->availableRect = display.work_area(); |
| 305 // TODO(derat|oshima): Don't hardcode this. Get this from display object. | 305 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
| 306 results->depth = 24; | 306 results->depth = 24; |
| 307 results->depthPerComponent = 8; | 307 results->depthPerComponent = 8; |
| 308 results->deviceScaleFactor = display.device_scale_factor(); | 308 results->deviceScaleFactor = display.device_scale_factor(); |
| 309 |
| 310 // The Display rotation and the WebScreenInfo orientation are not the same |
| 311 // angle. The former is the physical display rotation while the later is the |
| 312 // rotation required by the content to be shown properly on the screen, in |
| 313 // other words, relative to the physical display. |
| 309 results->orientationAngle = display.RotationAsDegree(); | 314 results->orientationAngle = display.RotationAsDegree(); |
| 315 if (results->orientationAngle == 90) |
| 316 results->orientationAngle = 270; |
| 317 else if (results->orientationAngle == 270) |
| 318 results->orientationAngle = 90; |
| 310 } | 319 } |
| 311 | 320 |
| 312 bool PointerEventActivates(const ui::Event& event) { | 321 bool PointerEventActivates(const ui::Event& event) { |
| 313 if (event.type() == ui::ET_MOUSE_PRESSED) | 322 if (event.type() == ui::ET_MOUSE_PRESSED) |
| 314 return true; | 323 return true; |
| 315 | 324 |
| 316 if (event.type() == ui::ET_GESTURE_BEGIN) { | 325 if (event.type() == ui::ET_GESTURE_BEGIN) { |
| 317 const ui::GestureEvent& gesture = | 326 const ui::GestureEvent& gesture = |
| 318 static_cast<const ui::GestureEvent&>(event); | 327 static_cast<const ui::GestureEvent&>(event); |
| 319 return gesture.details().touch_points() == 1; | 328 return gesture.details().touch_points() == 1; |
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 | 2440 |
| 2432 //////////////////////////////////////////////////////////////////////////////// | 2441 //////////////////////////////////////////////////////////////////////////////// |
| 2433 // RenderWidgetHostViewBase, public: | 2442 // RenderWidgetHostViewBase, public: |
| 2434 | 2443 |
| 2435 // static | 2444 // static |
| 2436 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2445 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2437 GetScreenInfoForWindow(results, NULL); | 2446 GetScreenInfoForWindow(results, NULL); |
| 2438 } | 2447 } |
| 2439 | 2448 |
| 2440 } // namespace content | 2449 } // namespace content |
| OLD | NEW |