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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "webkit/glue/webkit_glue.h" | 43 #include "webkit/glue/webkit_glue.h" |
44 #include "webkit/plugins/npapi/webplugin.h" | 44 #include "webkit/plugins/npapi/webplugin.h" |
45 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 45 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
46 | 46 |
47 #if defined(OS_POSIX) | 47 #if defined(OS_POSIX) |
48 #include "ipc/ipc_channel_posix.h" | 48 #include "ipc/ipc_channel_posix.h" |
49 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 49 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
50 #include "third_party/skia/include/core/SkPixelRef.h" | 50 #include "third_party/skia/include/core/SkPixelRef.h" |
51 #endif // defined(OS_POSIX) | 51 #endif // defined(OS_POSIX) |
52 | 52 |
53 #if defined(OS_ANDROID) | |
54 #include "content/common/android/device_info.h" | |
55 #endif // defined(OS_ANDROID) | |
56 | |
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
54 | 58 |
55 using WebKit::WebCompositionUnderline; | 59 using WebKit::WebCompositionUnderline; |
56 using WebKit::WebCursorInfo; | 60 using WebKit::WebCursorInfo; |
57 using WebKit::WebInputEvent; | 61 using WebKit::WebInputEvent; |
58 using WebKit::WebMouseEvent; | 62 using WebKit::WebMouseEvent; |
59 using WebKit::WebNavigationPolicy; | 63 using WebKit::WebNavigationPolicy; |
60 using WebKit::WebPagePopup; | 64 using WebKit::WebPagePopup; |
61 using WebKit::WebPoint; | 65 using WebKit::WebPoint; |
62 using WebKit::WebPopupMenu; | 66 using WebKit::WebPopupMenu; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 122 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
119 switches::kDisableGpuVsync); | 123 switches::kDisableGpuVsync); |
120 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 124 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
121 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; | 125 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; |
122 // Unless an explicit scale factor was provided for testing, ensure the scale | 126 // Unless an explicit scale factor was provided for testing, ensure the scale |
123 // is integral. | 127 // is integral. |
124 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 128 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
125 switches::kForceDeviceScaleFactor)) | 129 switches::kForceDeviceScaleFactor)) |
126 device_scale_factor_ = static_cast<int>(device_scale_factor_); | 130 device_scale_factor_ = static_cast<int>(device_scale_factor_); |
127 device_scale_factor_ = std::max(1.0f, device_scale_factor_); | 131 device_scale_factor_ = std::max(1.0f, device_scale_factor_); |
132 #elif defined(OS_ANDROID) | |
133 scoped_ptr<DeviceInfo> device_info(new DeviceInfo()); | |
134 device_scale_factor_ = device_info->GetDPIScale(); | |
johnme
2012/10/30 14:38:23
There's also device scale factor logic in ui/gfx/d
Sami
2012/10/31 11:12:57
Good idea. I looked into this a little more and it
| |
128 #endif | 135 #endif |
129 } | 136 } |
130 | 137 |
131 RenderWidget::~RenderWidget() { | 138 RenderWidget::~RenderWidget() { |
132 DCHECK(!webwidget_) << "Leaking our WebWidget!"; | 139 DCHECK(!webwidget_) << "Leaking our WebWidget!"; |
133 STLDeleteElements(&updates_pending_swap_); | 140 STLDeleteElements(&updates_pending_swap_); |
134 if (current_paint_buf_) { | 141 if (current_paint_buf_) { |
135 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); | 142 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); |
136 current_paint_buf_ = NULL; | 143 current_paint_buf_ = NULL; |
137 } | 144 } |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1903 | 1910 |
1904 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1911 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1905 return false; | 1912 return false; |
1906 } | 1913 } |
1907 | 1914 |
1908 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1915 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1909 return false; | 1916 return false; |
1910 } | 1917 } |
1911 | 1918 |
1912 } // namespace content | 1919 } // namespace content |
OLD | NEW |