| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "content/common/input_messages.h" | 46 #include "content/common/input_messages.h" |
| 47 #include "content/common/inter_process_time_ticks_converter.h" | 47 #include "content/common/inter_process_time_ticks_converter.h" |
| 48 #include "content/common/speech_recognition_messages.h" | 48 #include "content/common/speech_recognition_messages.h" |
| 49 #include "content/common/swapped_out_messages.h" | 49 #include "content/common/swapped_out_messages.h" |
| 50 #include "content/common/view_messages.h" | 50 #include "content/common/view_messages.h" |
| 51 #include "content/public/browser/ax_event_notification_details.h" | 51 #include "content/public/browser/ax_event_notification_details.h" |
| 52 #include "content/public/browser/browser_accessibility_state.h" | 52 #include "content/public/browser/browser_accessibility_state.h" |
| 53 #include "content/public/browser/browser_context.h" | 53 #include "content/public/browser/browser_context.h" |
| 54 #include "content/public/browser/browser_message_filter.h" | 54 #include "content/public/browser/browser_message_filter.h" |
| 55 #include "content/public/browser/content_browser_client.h" | 55 #include "content/public/browser/content_browser_client.h" |
| 56 #include "content/public/browser/focused_node_details.h" |
| 56 #include "content/public/browser/native_web_keyboard_event.h" | 57 #include "content/public/browser/native_web_keyboard_event.h" |
| 57 #include "content/public/browser/notification_details.h" | 58 #include "content/public/browser/notification_details.h" |
| 58 #include "content/public/browser/notification_service.h" | 59 #include "content/public/browser/notification_service.h" |
| 59 #include "content/public/browser/notification_types.h" | 60 #include "content/public/browser/notification_types.h" |
| 60 #include "content/public/browser/render_frame_host.h" | 61 #include "content/public/browser/render_frame_host.h" |
| 61 #include "content/public/browser/render_widget_host_iterator.h" | 62 #include "content/public/browser/render_widget_host_iterator.h" |
| 62 #include "content/public/browser/storage_partition.h" | 63 #include "content/public/browser/storage_partition.h" |
| 63 #include "content/public/browser/user_metrics.h" | 64 #include "content/public/browser/user_metrics.h" |
| 64 #include "content/public/common/bindings_policy.h" | 65 #include "content/public/common/bindings_policy.h" |
| 65 #include "content/public/common/content_constants.h" | 66 #include "content/public/common/content_constants.h" |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 Source<RenderViewHost>(this), | 1217 Source<RenderViewHost>(this), |
| 1217 NotificationService::NoDetails()); | 1218 NotificationService::NoDetails()); |
| 1218 } | 1219 } |
| 1219 | 1220 |
| 1220 void RenderViewHostImpl::OnTakeFocus(bool reverse) { | 1221 void RenderViewHostImpl::OnTakeFocus(bool reverse) { |
| 1221 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1222 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
| 1222 if (view) | 1223 if (view) |
| 1223 view->TakeFocus(reverse); | 1224 view->TakeFocus(reverse); |
| 1224 } | 1225 } |
| 1225 | 1226 |
| 1226 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { | 1227 void RenderViewHostImpl::OnFocusedNodeChanged( |
| 1228 bool is_editable_node, |
| 1229 const gfx::Rect& node_bounds_in_viewport) { |
| 1227 is_focused_element_editable_ = is_editable_node; | 1230 is_focused_element_editable_ = is_editable_node; |
| 1228 if (view_) | 1231 if (view_) |
| 1229 view_->FocusedNodeChanged(is_editable_node); | 1232 view_->FocusedNodeChanged(is_editable_node); |
| 1230 #if defined(OS_WIN) | 1233 #if defined(OS_WIN) |
| 1231 if (!is_editable_node && virtual_keyboard_requested_) { | 1234 if (!is_editable_node && virtual_keyboard_requested_) { |
| 1232 virtual_keyboard_requested_ = false; | 1235 virtual_keyboard_requested_ = false; |
| 1233 delegate_->SetIsVirtualKeyboardRequested(false); | 1236 delegate_->SetIsVirtualKeyboardRequested(false); |
| 1234 BrowserThread::PostDelayedTask( | 1237 BrowserThread::PostDelayedTask( |
| 1235 BrowserThread::UI, FROM_HERE, | 1238 BrowserThread::UI, FROM_HERE, |
| 1236 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 1239 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
| 1237 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 1240 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
| 1238 } | 1241 } |
| 1239 #endif | 1242 #endif |
| 1240 NotificationService::current()->Notify( | 1243 |
| 1241 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1244 // Convert node_bounds to screen coordinates. |
| 1242 Source<RenderViewHost>(this), | 1245 gfx::Rect view_bounds_in_screen = view_->GetViewBounds(); |
| 1243 Details<const bool>(&is_editable_node)); | 1246 gfx::Point origin = node_bounds_in_viewport.origin(); |
| 1247 origin.Offset(view_bounds_in_screen.x(), view_bounds_in_screen.y()); |
| 1248 gfx::Rect node_bounds_in_screen(origin.x(), origin.y(), |
| 1249 node_bounds_in_viewport.width(), |
| 1250 node_bounds_in_viewport.height()); |
| 1251 FocusedNodeDetails details = {is_editable_node, node_bounds_in_screen}; |
| 1252 NotificationService::current()->Notify(NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 1253 Source<RenderViewHost>(this), |
| 1254 Details<FocusedNodeDetails>(&details)); |
| 1244 } | 1255 } |
| 1245 | 1256 |
| 1246 void RenderViewHostImpl::OnUserGesture() { | 1257 void RenderViewHostImpl::OnUserGesture() { |
| 1247 delegate_->OnUserGesture(); | 1258 delegate_->OnUserGesture(); |
| 1248 } | 1259 } |
| 1249 | 1260 |
| 1250 void RenderViewHostImpl::OnClosePageACK() { | 1261 void RenderViewHostImpl::OnClosePageACK() { |
| 1251 decrement_in_flight_event_count(); | 1262 decrement_in_flight_event_count(); |
| 1252 ClosePageIgnoringUnloadEvents(); | 1263 ClosePageIgnoringUnloadEvents(); |
| 1253 } | 1264 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1495 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1485 | 1496 |
| 1486 frame_tree->ResetForMainFrameSwap(); | 1497 frame_tree->ResetForMainFrameSwap(); |
| 1487 } | 1498 } |
| 1488 | 1499 |
| 1489 void RenderViewHostImpl::SelectWordAroundCaret() { | 1500 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1490 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1501 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1491 } | 1502 } |
| 1492 | 1503 |
| 1493 } // namespace content | 1504 } // namespace content |
| OLD | NEW |