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" | |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
12 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
13 #include "content/browser/renderer_host/backing_store_skia.h" | 12 #include "content/browser/renderer_host/backing_store_skia.h" |
14 #include "content/browser/renderer_host/image_transport_client.h" | 13 #include "content/browser/renderer_host/image_transport_client.h" |
15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
16 #include "content/browser/renderer_host/web_input_event_aura.h" | 15 #include "content/browser/renderer_host/web_input_event_aura.h" |
17 #include "content/common/gpu/client/gl_helper.h" | 16 #include "content/common/gpu/client/gl_helper.h" |
18 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
19 #include "content/port/browser/render_widget_host_view_port.h" | 18 #include "content/port/browser/render_widget_host_view_port.h" |
20 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/common/content_switches.h" | |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
25 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
26 #include "ui/aura/client/tooltip_client.h" | 24 #include "ui/aura/client/tooltip_client.h" |
27 #include "ui/aura/client/window_types.h" | 25 #include "ui/aura/client/window_types.h" |
28 #include "ui/aura/env.h" | 26 #include "ui/aura/env.h" |
29 #include "ui/aura/event.h" | 27 #include "ui/aura/event.h" |
30 #include "ui/aura/root_window.h" | 28 #include "ui/aura/root_window.h" |
31 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 117 } |
120 | 118 |
121 void GetScreenInfoForWindow(WebKit::WebScreenInfo* results, | 119 void GetScreenInfoForWindow(WebKit::WebScreenInfo* results, |
122 aura::Window* window) { | 120 aura::Window* window) { |
123 const gfx::Monitor monitor = window ? | 121 const gfx::Monitor monitor = window ? |
124 gfx::Screen::GetMonitorNearestWindow(window) : | 122 gfx::Screen::GetMonitorNearestWindow(window) : |
125 gfx::Screen::GetPrimaryMonitor(); | 123 gfx::Screen::GetPrimaryMonitor(); |
126 const gfx::Size size = monitor.size(); | 124 const gfx::Size size = monitor.size(); |
127 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 125 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
128 results->availableRect = results->rect; | 126 results->availableRect = results->rect; |
129 // TODO(derat): Don't hardcode this? | 127 // TODO(derat|oshima): Don't hardcode this. Get this from monitor object. |
130 results->depth = 24; | 128 results->depth = 24; |
131 results->depthPerComponent = 8; | 129 results->depthPerComponent = 8; |
132 int default_dpi = monitor.device_scale_factor() * 160; | 130 int default_dpi = monitor.device_scale_factor() * 160; |
133 // TODO(fsamuel): This is a temporary hack until Monitor code is complete. | |
134 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
135 if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) { | |
136 int default_device_scale_factor; | |
137 base::StringToInt(command_line.GetSwitchValueASCII( | |
138 switches::kDefaultDeviceScaleFactor), | |
139 &default_device_scale_factor); | |
140 default_dpi = default_device_scale_factor * 160; | |
141 } | |
142 results->verticalDPI = default_dpi; | 131 results->verticalDPI = default_dpi; |
143 results->horizontalDPI = default_dpi; | 132 results->horizontalDPI = default_dpi; |
144 } | 133 } |
145 | 134 |
146 } // namespace | 135 } // namespace |
147 | 136 |
148 // We have to implement the WindowObserver interface on a separate object | 137 // We have to implement the WindowObserver interface on a separate object |
149 // because clang doesn't like implementing multiple interfaces that have | 138 // because clang doesn't like implementing multiple interfaces that have |
150 // methods with the same name. This object is owned by the | 139 // methods with the same name. This object is owned by the |
151 // RenderWidgetHostViewAura. | 140 // RenderWidgetHostViewAura. |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1315 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
1327 RenderWidgetHost* widget) { | 1316 RenderWidgetHost* widget) { |
1328 return new RenderWidgetHostViewAura(widget); | 1317 return new RenderWidgetHostViewAura(widget); |
1329 } | 1318 } |
1330 | 1319 |
1331 // static | 1320 // static |
1332 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1321 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1333 WebKit::WebScreenInfo* results) { | 1322 WebKit::WebScreenInfo* results) { |
1334 GetScreenInfoForWindow(results, NULL); | 1323 GetScreenInfoForWindow(results, NULL); |
1335 } | 1324 } |
OLD | NEW |