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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "ui/base/touch/touch_device.h" | 76 #include "ui/base/touch/touch_device.h" |
77 #include "ui/base/touch/touch_enabled.h" | 77 #include "ui/base/touch/touch_enabled.h" |
78 #include "ui/base/ui_base_switches.h" | 78 #include "ui/base/ui_base_switches.h" |
79 #include "ui/gfx/image/image_skia.h" | 79 #include "ui/gfx/image/image_skia.h" |
80 #include "ui/gfx/native_widget_types.h" | 80 #include "ui/gfx/native_widget_types.h" |
81 #include "ui/native_theme/native_theme_switches.h" | 81 #include "ui/native_theme/native_theme_switches.h" |
82 #include "ui/shell_dialogs/selected_file_info.h" | 82 #include "ui/shell_dialogs/selected_file_info.h" |
83 #include "url/url_constants.h" | 83 #include "url/url_constants.h" |
84 #include "webkit/browser/fileapi/isolated_context.h" | 84 #include "webkit/browser/fileapi/isolated_context.h" |
85 | 85 |
86 #if defined(OS_MACOSX) | 86 #if defined(OS_WIN) |
87 #include "content/browser/renderer_host/popup_menu_helper_mac.h" | |
88 #elif defined(OS_WIN) | |
89 #include "base/win/win_util.h" | 87 #include "base/win/win_util.h" |
90 #endif | 88 #endif |
91 | 89 |
92 #if defined(ENABLE_BROWSER_CDMS) | 90 #if defined(ENABLE_BROWSER_CDMS) |
93 #include "content/browser/media/media_web_contents_observer.h" | 91 #include "content/browser/media/media_web_contents_observer.h" |
94 #endif | 92 #endif |
95 | 93 |
96 using base::TimeDelta; | 94 using base::TimeDelta; |
97 using blink::WebConsoleMessage; | 95 using blink::WebConsoleMessage; |
98 using blink::WebDragOperation; | 96 using blink::WebDragOperation; |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 896 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
899 OnRouteCloseEvent) | 897 OnRouteCloseEvent) |
900 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
901 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 899 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
902 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 900 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
903 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 901 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
904 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 902 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
905 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 903 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
906 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
907 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 905 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
908 #if defined(OS_MACOSX) || defined(OS_ANDROID) | |
909 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) | |
910 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) | |
911 #endif | |
912 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 906 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
913 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | 907 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) |
914 // Have the super handle all other messages. | 908 // Have the super handle all other messages. |
915 IPC_MESSAGE_UNHANDLED( | 909 IPC_MESSAGE_UNHANDLED( |
916 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 910 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
917 IPC_END_MESSAGE_MAP() | 911 IPC_END_MESSAGE_MAP() |
918 | 912 |
919 return handled; | 913 return handled; |
920 } | 914 } |
921 | 915 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 void RenderViewHostImpl::ForwardKeyboardEvent( | 1287 void RenderViewHostImpl::ForwardKeyboardEvent( |
1294 const NativeWebKeyboardEvent& key_event) { | 1288 const NativeWebKeyboardEvent& key_event) { |
1295 if (ignore_input_events()) { | 1289 if (ignore_input_events()) { |
1296 if (key_event.type == WebInputEvent::RawKeyDown) | 1290 if (key_event.type == WebInputEvent::RawKeyDown) |
1297 delegate_->OnIgnoredUIEvent(); | 1291 delegate_->OnIgnoredUIEvent(); |
1298 return; | 1292 return; |
1299 } | 1293 } |
1300 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); | 1294 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); |
1301 } | 1295 } |
1302 | 1296 |
1303 #if defined(OS_ANDROID) | |
1304 void RenderViewHostImpl::DidSelectPopupMenuItems( | |
1305 const std::vector<int>& selected_indices) { | |
1306 Send(new ViewMsg_SelectPopupMenuItems(GetRoutingID(), false, | |
1307 selected_indices)); | |
1308 } | |
1309 | |
1310 void RenderViewHostImpl::DidCancelPopupMenu() { | |
1311 Send(new ViewMsg_SelectPopupMenuItems(GetRoutingID(), true, | |
1312 std::vector<int>())); | |
1313 } | |
1314 #endif | |
1315 | |
1316 #if defined(OS_MACOSX) | |
1317 void RenderViewHostImpl::DidSelectPopupMenuItem(int selected_index) { | |
1318 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), selected_index)); | |
1319 } | |
1320 | |
1321 void RenderViewHostImpl::DidCancelPopupMenu() { | |
1322 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), -1)); | |
1323 } | |
1324 #endif | |
1325 | |
1326 bool RenderViewHostImpl::IsWaitingForUnloadACK() const { | 1297 bool RenderViewHostImpl::IsWaitingForUnloadACK() const { |
1327 return rvh_state_ == STATE_WAITING_FOR_CLOSE || | 1298 return rvh_state_ == STATE_WAITING_FOR_CLOSE || |
1328 rvh_state_ == STATE_PENDING_SHUTDOWN || | 1299 rvh_state_ == STATE_PENDING_SHUTDOWN || |
1329 rvh_state_ == STATE_PENDING_SWAP_OUT; | 1300 rvh_state_ == STATE_PENDING_SWAP_OUT; |
1330 } | 1301 } |
1331 | 1302 |
1332 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( | 1303 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( |
1333 const base::string16& content, | 1304 const base::string16& content, |
1334 size_t start_offset, | 1305 size_t start_offset, |
1335 size_t end_offset) { | 1306 size_t end_offset) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 #if defined(OS_WIN) | 1427 #if defined(OS_WIN) |
1457 if (editable) { | 1428 if (editable) { |
1458 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | 1429 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
1459 } else { | 1430 } else { |
1460 virtual_keyboard_requested_ = false; | 1431 virtual_keyboard_requested_ = false; |
1461 base::win::DismissVirtualKeyboard(); | 1432 base::win::DismissVirtualKeyboard(); |
1462 } | 1433 } |
1463 #endif | 1434 #endif |
1464 } | 1435 } |
1465 | 1436 |
1466 #if defined(OS_MACOSX) || defined(OS_ANDROID) | |
1467 void RenderViewHostImpl::OnShowPopup( | |
1468 const ViewHostMsg_ShowPopup_Params& params) { | |
1469 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | |
1470 if (view) { | |
1471 view->ShowPopupMenu(params.bounds, | |
1472 params.item_height, | |
1473 params.item_font_size, | |
1474 params.selected_item, | |
1475 params.popup_items, | |
1476 params.right_aligned, | |
1477 params.allow_multiple_selection); | |
1478 } | |
1479 } | |
1480 | |
1481 void RenderViewHostImpl::OnHidePopup() { | |
1482 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | |
1483 if (view) | |
1484 view->HidePopupMenu(); | |
1485 } | |
1486 #endif | |
1487 | |
1488 void RenderViewHostImpl::SetState(RenderViewHostImplState rvh_state) { | 1437 void RenderViewHostImpl::SetState(RenderViewHostImplState rvh_state) { |
1489 // We update the number of RenderViews in a SiteInstance when the | 1438 // We update the number of RenderViews in a SiteInstance when the |
1490 // swapped out status of this RenderView gets flipped to/from live. | 1439 // swapped out status of this RenderView gets flipped to/from live. |
1491 if (!IsRVHStateActive(rvh_state_) && IsRVHStateActive(rvh_state)) | 1440 if (!IsRVHStateActive(rvh_state_) && IsRVHStateActive(rvh_state)) |
1492 instance_->increment_active_view_count(); | 1441 instance_->increment_active_view_count(); |
1493 else if (IsRVHStateActive(rvh_state_) && !IsRVHStateActive(rvh_state)) | 1442 else if (IsRVHStateActive(rvh_state_) && !IsRVHStateActive(rvh_state)) |
1494 instance_->decrement_active_view_count(); | 1443 instance_->decrement_active_view_count(); |
1495 | 1444 |
1496 // Whenever we change the RVH state to and from live or swapped out state, we | 1445 // Whenever we change the RVH state to and from live or swapped out state, we |
1497 // should not be waiting for beforeunload or unload acks. We clear them here | 1446 // should not be waiting for beforeunload or unload acks. We clear them here |
(...skipping 26 matching lines...) Expand all Loading... |
1524 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1473 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1525 | 1474 |
1526 frame_tree->ResetForMainFrameSwap(); | 1475 frame_tree->ResetForMainFrameSwap(); |
1527 } | 1476 } |
1528 | 1477 |
1529 void RenderViewHostImpl::SelectWordAroundCaret() { | 1478 void RenderViewHostImpl::SelectWordAroundCaret() { |
1530 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1479 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1531 } | 1480 } |
1532 | 1481 |
1533 } // namespace content | 1482 } // namespace content |
OLD | NEW |