| 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 OnRouteCloseEvent) | 825 OnRouteCloseEvent) |
| 826 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 826 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| 827 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 827 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
| 828 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 828 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 829 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 829 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
| 830 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 830 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 831 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 831 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
| 832 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 832 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
| 833 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 833 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
| 834 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 834 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
| 835 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | |
| 836 // Have the super handle all other messages. | 835 // Have the super handle all other messages. |
| 837 IPC_MESSAGE_UNHANDLED( | 836 IPC_MESSAGE_UNHANDLED( |
| 838 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 837 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
| 839 IPC_END_MESSAGE_MAP() | 838 IPC_END_MESSAGE_MAP() |
| 840 | 839 |
| 841 return handled; | 840 return handled; |
| 842 } | 841 } |
| 843 | 842 |
| 844 void RenderViewHostImpl::Init() { | 843 void RenderViewHostImpl::Init() { |
| 845 RenderWidgetHostImpl::Init(); | 844 RenderWidgetHostImpl::Init(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 Source<RenderViewHost>(this), | 1135 Source<RenderViewHost>(this), |
| 1137 NotificationService::NoDetails()); | 1136 NotificationService::NoDetails()); |
| 1138 } | 1137 } |
| 1139 | 1138 |
| 1140 void RenderViewHostImpl::OnTakeFocus(bool reverse) { | 1139 void RenderViewHostImpl::OnTakeFocus(bool reverse) { |
| 1141 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1140 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
| 1142 if (view) | 1141 if (view) |
| 1143 view->TakeFocus(reverse); | 1142 view->TakeFocus(reverse); |
| 1144 } | 1143 } |
| 1145 | 1144 |
| 1146 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { | 1145 void RenderViewHostImpl::OnFocusedNodeChanged( |
| 1146 bool is_editable_node, |
| 1147 blink::WebInputEvent::Type causel_event_type) { |
| 1147 is_focused_element_editable_ = is_editable_node; | 1148 is_focused_element_editable_ = is_editable_node; |
| 1148 if (view_) | 1149 if (view_) |
| 1149 view_->FocusedNodeChanged(is_editable_node); | 1150 view_->FocusedNodeChanged(is_editable_node); |
| 1150 #if defined(OS_WIN) | 1151 #if defined(OS_WIN) |
| 1151 if (!is_editable_node && virtual_keyboard_requested_) { | 1152 if (causal_event_type == blink::WebInputEvent::GestureTap) { |
| 1153 if (is_editable_node) { |
| 1154 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
| 1155 } else { |
| 1156 virtual_keyboard_requested_ = false; |
| 1157 base::win::DismissVirtualKeyboard(); |
| 1158 } |
| 1159 } else if (!is_editable_node && virtual_keyboard_requested_) { |
| 1152 virtual_keyboard_requested_ = false; | 1160 virtual_keyboard_requested_ = false; |
| 1153 BrowserThread::PostDelayedTask( | 1161 BrowserThread::PostDelayedTask( |
| 1154 BrowserThread::UI, FROM_HERE, | 1162 BrowserThread::UI, FROM_HERE, |
| 1155 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 1163 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
| 1156 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 1164 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
| 1157 } | 1165 } |
| 1158 #endif | 1166 #endif |
| 1159 NotificationService::current()->Notify( | 1167 NotificationService::current()->Notify( |
| 1160 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1168 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 1161 Source<RenderViewHost>(this), | 1169 Source<RenderViewHost>(this), |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 host_zoom_map->SetZoomLevelForView(GetProcess()->GetID(), | 1364 host_zoom_map->SetZoomLevelForView(GetProcess()->GetID(), |
| 1357 GetRoutingID(), | 1365 GetRoutingID(), |
| 1358 zoom_level, | 1366 zoom_level, |
| 1359 net::GetHostOrSpecFromURL(url)); | 1367 net::GetHostOrSpecFromURL(url)); |
| 1360 } | 1368 } |
| 1361 | 1369 |
| 1362 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { | 1370 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { |
| 1363 delegate_->RunFileChooser(this, params); | 1371 delegate_->RunFileChooser(this, params); |
| 1364 } | 1372 } |
| 1365 | 1373 |
| 1366 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { | |
| 1367 #if defined(OS_WIN) | |
| 1368 if (editable) { | |
| 1369 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | |
| 1370 } else { | |
| 1371 virtual_keyboard_requested_ = false; | |
| 1372 base::win::DismissVirtualKeyboard(); | |
| 1373 } | |
| 1374 #endif | |
| 1375 } | |
| 1376 | |
| 1377 bool RenderViewHostImpl::CanAccessFilesOfPageState( | 1374 bool RenderViewHostImpl::CanAccessFilesOfPageState( |
| 1378 const PageState& state) const { | 1375 const PageState& state) const { |
| 1379 ChildProcessSecurityPolicyImpl* policy = | 1376 ChildProcessSecurityPolicyImpl* policy = |
| 1380 ChildProcessSecurityPolicyImpl::GetInstance(); | 1377 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 1381 | 1378 |
| 1382 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); | 1379 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); |
| 1383 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); | 1380 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); |
| 1384 file != file_paths.end(); ++file) { | 1381 file != file_paths.end(); ++file) { |
| 1385 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) | 1382 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) |
| 1386 return false; | 1383 return false; |
| 1387 } | 1384 } |
| 1388 return true; | 1385 return true; |
| 1389 } | 1386 } |
| 1390 | 1387 |
| 1391 void RenderViewHostImpl::AttachToFrameTree() { | 1388 void RenderViewHostImpl::AttachToFrameTree() { |
| 1392 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1389 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1393 | 1390 |
| 1394 frame_tree->ResetForMainFrameSwap(); | 1391 frame_tree->ResetForMainFrameSwap(); |
| 1395 } | 1392 } |
| 1396 | 1393 |
| 1397 void RenderViewHostImpl::SelectWordAroundCaret() { | 1394 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1398 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1395 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1399 } | 1396 } |
| 1400 | 1397 |
| 1401 } // namespace content | 1398 } // namespace content |
| OLD | NEW |