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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 default: | 140 default: |
141 break; | 141 break; |
142 } | 142 } |
143 #endif | 143 #endif |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { | 147 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { |
148 const gfx::Display display = window ? | 148 const gfx::Display display = window ? |
149 gfx::Screen::GetDisplayNearestWindow(window) : | 149 gfx::Screen::GetDisplayNearestWindow(window) : |
150 gfx::Screen::GetPrimaryDisplay(); | 150 gfx::Screen::GetPrimaryDisplay(gfx::Screen::BadTwoWorldsContext()); |
151 const gfx::Size size = display.size(); | 151 const gfx::Size size = display.size(); |
152 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 152 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
153 results->availableRect = results->rect; | 153 results->availableRect = results->rect; |
154 // TODO(derat|oshima): Don't hardcode this. Get this from display object. | 154 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
155 results->depth = 24; | 155 results->depth = 24; |
156 results->depthPerComponent = 8; | 156 results->depthPerComponent = 8; |
157 int default_dpi = display.device_scale_factor() * 160; | 157 int default_dpi = display.device_scale_factor() * 160; |
158 results->verticalDPI = default_dpi; | 158 results->verticalDPI = default_dpi; |
159 results->horizontalDPI = default_dpi; | 159 results->horizontalDPI = default_dpi; |
160 } | 160 } |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 for (size_t i = 0; i != pending_thumbnail_tasks_.size(); ++i) | 1696 for (size_t i = 0; i != pending_thumbnail_tasks_.size(); ++i) |
1697 pending_thumbnail_tasks_[i].Run(false); | 1697 pending_thumbnail_tasks_[i].Run(false); |
1698 | 1698 |
1699 // This call is usually no-op since |this| object is already removed from the | 1699 // This call is usually no-op since |this| object is already removed from the |
1700 // Aura root window and we don't have a way to get an input method object | 1700 // Aura root window and we don't have a way to get an input method object |
1701 // associated with the window, but just in case. | 1701 // associated with the window, but just in case. |
1702 DetachFromInputMethod(); | 1702 DetachFromInputMethod(); |
1703 } | 1703 } |
1704 | 1704 |
1705 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 1705 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
1706 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); | 1706 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint( |
| 1707 gfx::Screen::BadTwoWorldsContext()); |
1707 aura::RootWindow* root_window = window_->GetRootWindow(); | 1708 aura::RootWindow* root_window = window_->GetRootWindow(); |
1708 if (!root_window) | 1709 if (!root_window) |
1709 return; | 1710 return; |
1710 | 1711 |
1711 gfx::Rect screen_rect = GetViewBounds(); | 1712 gfx::Rect screen_rect = GetViewBounds(); |
1712 gfx::Point local_point = screen_point; | 1713 gfx::Point local_point = screen_point; |
1713 local_point.Offset(-screen_rect.x(), -screen_rect.y()); | 1714 local_point.Offset(-screen_rect.x(), -screen_rect.y()); |
1714 | 1715 |
1715 if (root_window->GetEventHandlerForPoint(local_point) != window_) | 1716 if (root_window->GetEventHandlerForPoint(local_point) != window_) |
1716 return; | 1717 return; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 RenderWidgetHost* widget) { | 1872 RenderWidgetHost* widget) { |
1872 return new RenderWidgetHostViewAura(widget); | 1873 return new RenderWidgetHostViewAura(widget); |
1873 } | 1874 } |
1874 | 1875 |
1875 // static | 1876 // static |
1876 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1877 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1877 GetScreenInfoForWindow(results, NULL); | 1878 GetScreenInfoForWindow(results, NULL); |
1878 } | 1879 } |
1879 | 1880 |
1880 } // namespace content | 1881 } // namespace content |
OLD | NEW |