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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "content/browser/renderer_host/backing_store_skia.h" 13 #include "content/browser/renderer_host/backing_store_skia.h"
14 #include "content/browser/renderer_host/image_transport_client.h" 14 #include "content/browser/renderer_host/image_transport_client.h"
15 #include "content/browser/renderer_host/render_widget_host_impl.h" 15 #include "content/browser/renderer_host/render_widget_host_impl.h"
16 #include "content/browser/renderer_host/web_input_event_aura.h" 16 #include "content/browser/renderer_host/web_input_event_aura.h"
17 #include "content/common/gpu/client/gl_helper.h" 17 #include "content/common/gpu/client/gl_helper.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/port/browser/render_widget_host_view_port.h" 19 #include "content/port/browser/render_widget_host_view_port.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
25 #include "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/client/tooltip_client.h" 26 #include "ui/aura/client/tooltip_client.h"
27 #include "ui/aura/client/window_types.h" 27 #include "ui/aura/client/window_types.h"
28 #include "ui/aura/env.h" 28 #include "ui/aura/env.h"
29 #include "ui/aura/event.h" 29 #include "ui/aura/event.h"
30 #include "ui/aura/monitor.h"
31 #include "ui/aura/monitor_manager.h"
32 #include "ui/aura/root_window.h" 30 #include "ui/aura/root_window.h"
33 #include "ui/aura/window.h" 31 #include "ui/aura/window.h"
34 #include "ui/aura/window_observer.h" 32 #include "ui/aura/window_observer.h"
35 #include "ui/base/gestures/gesture_recognizer.h" 33 #include "ui/base/gestures/gesture_recognizer.h"
36 #include "ui/base/hit_test.h" 34 #include "ui/base/hit_test.h"
37 #include "ui/base/ime/input_method.h" 35 #include "ui/base/ime/input_method.h"
38 #include "ui/base/ui_base_types.h" 36 #include "ui/base/ui_base_types.h"
39 #include "ui/gfx/canvas.h" 37 #include "ui/gfx/canvas.h"
40 #include "ui/gfx/compositor/compositor.h" 38 #include "ui/gfx/compositor/compositor.h"
41 #include "ui/gfx/compositor/layer.h" 39 #include "ui/gfx/compositor/layer.h"
40 #include "ui/gfx/monitor.h"
42 #include "ui/gfx/screen.h" 41 #include "ui/gfx/screen.h"
43 #include "ui/gfx/skia_util.h" 42 #include "ui/gfx/skia_util.h"
44 43
45 using content::BrowserThread; 44 using content::BrowserThread;
46 using content::RenderWidgetHost; 45 using content::RenderWidgetHost;
47 using content::RenderWidgetHostImpl; 46 using content::RenderWidgetHostImpl;
48 using content::RenderWidgetHostView; 47 using content::RenderWidgetHostView;
49 using WebKit::WebTouchEvent; 48 using WebKit::WebTouchEvent;
50 49
51 namespace { 50 namespace {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 WebKit::WebGraphicsContext3D* context = 112 WebKit::WebGraphicsContext3D* context =
114 factory->GetSharedContext(compositor); 113 factory->GetSharedContext(compositor);
115 DCHECK(context); 114 DCHECK(context);
116 WebKit::WebGraphicsContext3D* context_for_thread = 115 WebKit::WebGraphicsContext3D* context_for_thread =
117 factory->AsContextFactory()->CreateOffscreenContext(compositor); 116 factory->AsContextFactory()->CreateOffscreenContext(compositor);
118 DCHECK(context_for_thread); 117 DCHECK(context_for_thread);
119 return new content::GLHelper(context, context_for_thread); 118 return new content::GLHelper(context, context_for_thread);
120 } 119 }
121 120
122 void GetScreenInfoForWindow(WebKit::WebScreenInfo* results, 121 void GetScreenInfoForWindow(WebKit::WebScreenInfo* results,
123 const aura::Window* window) { 122 aura::Window* window) {
124 aura::MonitorManager* monitor_manager = 123 const gfx::Monitor monitor = window ?
125 aura::Env::GetInstance()->monitor_manager(); 124 gfx::Screen::GetMonitorNearestWindow(window) :
126 const aura::Monitor* monitor = window ? 125 gfx::Screen::GetPrimaryMonitor();
127 monitor_manager->GetMonitorNearestWindow(window) : 126 const gfx::Size size = monitor.size();
128 monitor_manager->GetMonitorAt(0);
129
130 const gfx::Size size = monitor->size();
131 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); 127 results->rect = WebKit::WebRect(0, 0, size.width(), size.height());
132 results->availableRect = results->rect; 128 results->availableRect = results->rect;
133 // TODO(derat): Don't hardcode this? 129 // TODO(derat): Don't hardcode this?
134 results->depth = 24; 130 results->depth = 24;
135 results->depthPerComponent = 8; 131 results->depthPerComponent = 8;
136 int default_dpi = monitor->GetDeviceScaleFactor() * 160; 132 int default_dpi = monitor.device_scale_factor() * 160;
137 // TODO(fsamuel): This is a temporary hack until Monitor code is complete. 133 // TODO(fsamuel): This is a temporary hack until Monitor code is complete.
138 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 134 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
139 if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) { 135 if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) {
140 int default_device_scale_factor; 136 int default_device_scale_factor;
141 base::StringToInt(command_line.GetSwitchValueASCII( 137 base::StringToInt(command_line.GetSwitchValueASCII(
142 switches::kDefaultDeviceScaleFactor), 138 switches::kDefaultDeviceScaleFactor),
143 &default_device_scale_factor); 139 &default_device_scale_factor);
144 default_dpi = default_device_scale_factor * 160; 140 default_dpi = default_device_scale_factor * 160;
145 } 141 }
146 results->verticalDPI = default_dpi; 142 results->verticalDPI = default_dpi;
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1318 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1323 RenderWidgetHost* widget) { 1319 RenderWidgetHost* widget) {
1324 return new RenderWidgetHostViewAura(widget); 1320 return new RenderWidgetHostViewAura(widget);
1325 } 1321 }
1326 1322
1327 // static 1323 // static
1328 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 1324 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1329 WebKit::WebScreenInfo* results) { 1325 WebKit::WebScreenInfo* results) {
1330 GetScreenInfoForWindow(results, NULL); 1326 GetScreenInfoForWindow(results, NULL);
1331 } 1327 }
OLDNEW
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.cc ('k') | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698