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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 Source<RenderViewHost>(this), | 1216 Source<RenderViewHost>(this), |
1217 NotificationService::NoDetails()); | 1217 NotificationService::NoDetails()); |
1218 } | 1218 } |
1219 | 1219 |
1220 void RenderViewHostImpl::OnTakeFocus(bool reverse) { | 1220 void RenderViewHostImpl::OnTakeFocus(bool reverse) { |
1221 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1221 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
1222 if (view) | 1222 if (view) |
1223 view->TakeFocus(reverse); | 1223 view->TakeFocus(reverse); |
1224 } | 1224 } |
1225 | 1225 |
1226 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { | 1226 void RenderViewHostImpl::OnFocusedNodeChanged( |
| 1227 bool is_editable_node, |
| 1228 const gfx::Rect& node_bounds_in_viewport) { |
1227 is_focused_element_editable_ = is_editable_node; | 1229 is_focused_element_editable_ = is_editable_node; |
1228 if (view_) | 1230 if (view_) |
1229 view_->FocusedNodeChanged(is_editable_node); | 1231 view_->FocusedNodeChanged(is_editable_node); |
1230 #if defined(OS_WIN) | 1232 #if defined(OS_WIN) |
1231 if (!is_editable_node && virtual_keyboard_requested_) { | 1233 if (!is_editable_node && virtual_keyboard_requested_) { |
1232 virtual_keyboard_requested_ = false; | 1234 virtual_keyboard_requested_ = false; |
1233 delegate_->SetIsVirtualKeyboardRequested(false); | 1235 delegate_->SetIsVirtualKeyboardRequested(false); |
1234 BrowserThread::PostDelayedTask( | 1236 BrowserThread::PostDelayedTask( |
1235 BrowserThread::UI, FROM_HERE, | 1237 BrowserThread::UI, FROM_HERE, |
1236 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 1238 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
1237 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 1239 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
1238 } | 1240 } |
1239 #endif | 1241 #endif |
1240 NotificationService::current()->Notify( | 1242 |
1241 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1243 // Convert node_bounds to screen coordinates. |
1242 Source<RenderViewHost>(this), | 1244 gfx::Rect view_bounds_in_screen = view_->GetViewBounds(); |
1243 Details<const bool>(&is_editable_node)); | 1245 gfx::Point origin = node_bounds_in_viewport.origin(); |
| 1246 origin.Offset(view_bounds_in_screen.x(), view_bounds_in_screen.y()); |
| 1247 gfx::Rect node_bounds_in_screen(origin.x(), origin.y(), |
| 1248 node_bounds_in_viewport.width(), |
| 1249 node_bounds_in_viewport.height()); |
| 1250 FocusedNodeDetails details = {is_editable_node, node_bounds_in_screen}; |
| 1251 NotificationService::current()->Notify(NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 1252 Source<RenderViewHost>(this), |
| 1253 Details<FocusedNodeDetails>(&details)); |
1244 } | 1254 } |
1245 | 1255 |
1246 void RenderViewHostImpl::OnUserGesture() { | 1256 void RenderViewHostImpl::OnUserGesture() { |
1247 delegate_->OnUserGesture(); | 1257 delegate_->OnUserGesture(); |
1248 } | 1258 } |
1249 | 1259 |
1250 void RenderViewHostImpl::OnClosePageACK() { | 1260 void RenderViewHostImpl::OnClosePageACK() { |
1251 decrement_in_flight_event_count(); | 1261 decrement_in_flight_event_count(); |
1252 ClosePageIgnoringUnloadEvents(); | 1262 ClosePageIgnoringUnloadEvents(); |
1253 } | 1263 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1494 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1485 | 1495 |
1486 frame_tree->ResetForMainFrameSwap(); | 1496 frame_tree->ResetForMainFrameSwap(); |
1487 } | 1497 } |
1488 | 1498 |
1489 void RenderViewHostImpl::SelectWordAroundCaret() { | 1499 void RenderViewHostImpl::SelectWordAroundCaret() { |
1490 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1500 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1491 } | 1501 } |
1492 | 1502 |
1493 } // namespace content | 1503 } // namespace content |
OLD | NEW |