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_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "ui/base/touch/touch_device.h" | 82 #include "ui/base/touch/touch_device.h" |
83 #include "ui/base/touch/touch_enabled.h" | 83 #include "ui/base/touch/touch_enabled.h" |
84 #include "ui/base/ui_base_switches.h" | 84 #include "ui/base/ui_base_switches.h" |
85 #include "ui/gfx/image/image_skia.h" | 85 #include "ui/gfx/image/image_skia.h" |
86 #include "ui/gfx/native_widget_types.h" | 86 #include "ui/gfx/native_widget_types.h" |
87 #include "ui/native_theme/native_theme_switches.h" | 87 #include "ui/native_theme/native_theme_switches.h" |
88 #include "url/url_constants.h" | 88 #include "url/url_constants.h" |
89 | 89 |
90 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
91 #include "base/win/win_util.h" | 91 #include "base/win/win_util.h" |
| 92 #include "ui/gfx/platform_font_win.h" |
| 93 #include "ui/gfx/win/dpi.h" |
92 #endif | 94 #endif |
93 | 95 |
94 using base::TimeDelta; | 96 using base::TimeDelta; |
95 using blink::WebConsoleMessage; | 97 using blink::WebConsoleMessage; |
96 using blink::WebDragOperation; | 98 using blink::WebDragOperation; |
97 using blink::WebDragOperationNone; | 99 using blink::WebDragOperationNone; |
98 using blink::WebDragOperationsMask; | 100 using blink::WebDragOperationsMask; |
99 using blink::WebInputEvent; | 101 using blink::WebInputEvent; |
100 using blink::WebMediaPlayerAction; | 102 using blink::WebMediaPlayerAction; |
101 using blink::WebPluginAction; | 103 using blink::WebPluginAction; |
(...skipping 15 matching lines...) Expand all Loading... |
117 BrowserThread::PostDelayedTask( | 119 BrowserThread::PostDelayedTask( |
118 BrowserThread::UI, FROM_HERE, | 120 BrowserThread::UI, FROM_HERE, |
119 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 121 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
120 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 122 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
121 ++virtual_keyboard_display_retries; | 123 ++virtual_keyboard_display_retries; |
122 } else { | 124 } else { |
123 virtual_keyboard_display_retries = 0; | 125 virtual_keyboard_display_retries = 0; |
124 } | 126 } |
125 } | 127 } |
126 } | 128 } |
| 129 |
| 130 void GetWindowsSpecificPrefs(RendererPreferences* prefs) { |
| 131 NONCLIENTMETRICS_XP metrics = {0}; |
| 132 base::win::GetNonClientMetrics(&metrics); |
| 133 |
| 134 prefs->caption_font_family_name = metrics.lfCaptionFont.lfFaceName; |
| 135 prefs->caption_font_height = gfx::PlatformFontWin::GetFontSize( |
| 136 metrics.lfCaptionFont); |
| 137 |
| 138 prefs->small_caption_font_family_name = metrics.lfSmCaptionFont.lfFaceName; |
| 139 prefs->small_caption_font_height = gfx::PlatformFontWin::GetFontSize( |
| 140 metrics.lfSmCaptionFont); |
| 141 |
| 142 prefs->menu_font_family_name = metrics.lfMenuFont.lfFaceName; |
| 143 prefs->menu_font_height = gfx::PlatformFontWin::GetFontSize( |
| 144 metrics.lfMenuFont); |
| 145 |
| 146 prefs->status_font_family_name = metrics.lfStatusFont.lfFaceName; |
| 147 prefs->status_font_height = gfx::PlatformFontWin::GetFontSize( |
| 148 metrics.lfStatusFont); |
| 149 |
| 150 prefs->message_font_family_name = metrics.lfMessageFont.lfFaceName; |
| 151 prefs->message_font_height = gfx::PlatformFontWin::GetFontSize( |
| 152 metrics.lfMessageFont); |
| 153 |
| 154 prefs->vertical_scroll_bar_width_in_dips = |
| 155 gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL); |
| 156 prefs->horizontal_scroll_bar_height_in_dips = |
| 157 gfx::win::GetSystemMetricsInDIP(SM_CYHSCROLL); |
| 158 prefs->arrow_bitmap_height_vertical_scroll_bar_in_dips = |
| 159 gfx::win::GetSystemMetricsInDIP(SM_CYVSCROLL); |
| 160 prefs->arrow_bitmap_width_horizontal_scroll_bar_in_dips = |
| 161 gfx::win::GetSystemMetricsInDIP(SM_CXHSCROLL); |
| 162 } |
127 #endif | 163 #endif |
128 | 164 |
129 } // namespace | 165 } // namespace |
130 | 166 |
131 // static | 167 // static |
132 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000; | 168 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000; |
133 | 169 |
134 /////////////////////////////////////////////////////////////////////////////// | 170 /////////////////////////////////////////////////////////////////////////////// |
135 // RenderViewHost, public: | 171 // RenderViewHost, public: |
136 | 172 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 296 |
261 // Ensure the RenderView starts with a next_page_id larger than any existing | 297 // Ensure the RenderView starts with a next_page_id larger than any existing |
262 // page ID it might be asked to render. | 298 // page ID it might be asked to render. |
263 int32 next_page_id = 1; | 299 int32 next_page_id = 1; |
264 if (max_page_id > -1) | 300 if (max_page_id > -1) |
265 next_page_id = max_page_id + 1; | 301 next_page_id = max_page_id + 1; |
266 | 302 |
267 ViewMsg_New_Params params; | 303 ViewMsg_New_Params params; |
268 params.renderer_preferences = | 304 params.renderer_preferences = |
269 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 305 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 306 #if defined(OS_WIN) |
| 307 GetWindowsSpecificPrefs(¶ms.renderer_preferences); |
| 308 #endif |
270 params.web_preferences = GetWebkitPreferences(); | 309 params.web_preferences = GetWebkitPreferences(); |
271 params.view_id = GetRoutingID(); | 310 params.view_id = GetRoutingID(); |
272 params.main_frame_routing_id = main_frame_routing_id_; | 311 params.main_frame_routing_id = main_frame_routing_id_; |
273 params.surface_id = surface_id(); | 312 params.surface_id = surface_id(); |
274 params.session_storage_namespace_id = | 313 params.session_storage_namespace_id = |
275 delegate_->GetSessionStorageNamespace(instance_.get())->id(); | 314 delegate_->GetSessionStorageNamespace(instance_.get())->id(); |
276 params.frame_name = frame_name; | 315 params.frame_name = frame_name; |
277 // Ensure the RenderView sets its opener correctly. | 316 // Ensure the RenderView sets its opener correctly. |
278 params.opener_route_id = opener_route_id; | 317 params.opener_route_id = opener_route_id; |
279 params.swapped_out = !is_active_; | 318 params.swapped_out = !is_active_; |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1449 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1411 | 1450 |
1412 frame_tree->ResetForMainFrameSwap(); | 1451 frame_tree->ResetForMainFrameSwap(); |
1413 } | 1452 } |
1414 | 1453 |
1415 void RenderViewHostImpl::SelectWordAroundCaret() { | 1454 void RenderViewHostImpl::SelectWordAroundCaret() { |
1416 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1455 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1417 } | 1456 } |
1418 | 1457 |
1419 } // namespace content | 1458 } // namespace content |
OLD | NEW |