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