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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 895 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
898 OnRouteCloseEvent) | 896 OnRouteCloseEvent) |
899 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 897 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
900 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 898 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
901 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 899 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
902 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 900 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
903 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 901 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
904 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 902 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
905 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 903 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
906 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
907 #if defined(OS_MACOSX) || defined(OS_ANDROID) | |
908 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) | |
909 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) | |
910 #endif | |
911 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 905 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
912 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | 906 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) |
913 // Have the super handle all other messages. | 907 // Have the super handle all other messages. |
914 IPC_MESSAGE_UNHANDLED( | 908 IPC_MESSAGE_UNHANDLED( |
915 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 909 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
916 IPC_END_MESSAGE_MAP() | 910 IPC_END_MESSAGE_MAP() |
917 | 911 |
918 return handled; | 912 return handled; |
919 } | 913 } |
920 | 914 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 void RenderViewHostImpl::ForwardKeyboardEvent( | 1310 void RenderViewHostImpl::ForwardKeyboardEvent( |
1317 const NativeWebKeyboardEvent& key_event) { | 1311 const NativeWebKeyboardEvent& key_event) { |
1318 if (ignore_input_events()) { | 1312 if (ignore_input_events()) { |
1319 if (key_event.type == WebInputEvent::RawKeyDown) | 1313 if (key_event.type == WebInputEvent::RawKeyDown) |
1320 delegate_->OnIgnoredUIEvent(); | 1314 delegate_->OnIgnoredUIEvent(); |
1321 return; | 1315 return; |
1322 } | 1316 } |
1323 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); | 1317 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); |
1324 } | 1318 } |
1325 | 1319 |
1326 #if defined(OS_ANDROID) | |
1327 void RenderViewHostImpl::DidSelectPopupMenuItems( | |
1328 const std::vector<int>& selected_indices) { | |
1329 Send(new ViewMsg_SelectPopupMenuItems(GetRoutingID(), false, | |
1330 selected_indices)); | |
1331 } | |
1332 | |
1333 void RenderViewHostImpl::DidCancelPopupMenu() { | |
1334 Send(new ViewMsg_SelectPopupMenuItems(GetRoutingID(), true, | |
1335 std::vector<int>())); | |
1336 } | |
1337 #endif | |
1338 | |
1339 #if defined(OS_MACOSX) | |
1340 void RenderViewHostImpl::DidSelectPopupMenuItem(int selected_index) { | |
1341 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), selected_index)); | |
1342 } | |
1343 | |
1344 void RenderViewHostImpl::DidCancelPopupMenu() { | |
1345 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), -1)); | |
1346 } | |
1347 #endif | |
1348 | |
1349 bool RenderViewHostImpl::IsWaitingForUnloadACK() const { | 1320 bool RenderViewHostImpl::IsWaitingForUnloadACK() const { |
1350 return rvh_state_ == STATE_WAITING_FOR_CLOSE || | 1321 return rvh_state_ == STATE_WAITING_FOR_CLOSE || |
1351 rvh_state_ == STATE_PENDING_SHUTDOWN || | 1322 rvh_state_ == STATE_PENDING_SHUTDOWN || |
1352 rvh_state_ == STATE_PENDING_SWAP_OUT; | 1323 rvh_state_ == STATE_PENDING_SWAP_OUT; |
1353 } | 1324 } |
1354 | 1325 |
1355 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( | 1326 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( |
1356 const base::string16& content, | 1327 const base::string16& content, |
1357 size_t start_offset, | 1328 size_t start_offset, |
1358 size_t end_offset) { | 1329 size_t end_offset) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 #if defined(OS_WIN) | 1443 #if defined(OS_WIN) |
1473 if (editable) { | 1444 if (editable) { |
1474 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | 1445 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
1475 } else { | 1446 } else { |
1476 virtual_keyboard_requested_ = false; | 1447 virtual_keyboard_requested_ = false; |
1477 base::win::DismissVirtualKeyboard(); | 1448 base::win::DismissVirtualKeyboard(); |
1478 } | 1449 } |
1479 #endif | 1450 #endif |
1480 } | 1451 } |
1481 | 1452 |
1482 #if defined(OS_MACOSX) || defined(OS_ANDROID) | |
1483 void RenderViewHostImpl::OnShowPopup( | |
1484 const ViewHostMsg_ShowPopup_Params& params) { | |
1485 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | |
1486 if (view) { | |
1487 view->ShowPopupMenu(params.bounds, | |
1488 params.item_height, | |
1489 params.item_font_size, | |
1490 params.selected_item, | |
1491 params.popup_items, | |
1492 params.right_aligned, | |
1493 params.allow_multiple_selection); | |
1494 } | |
1495 } | |
1496 | |
1497 void RenderViewHostImpl::OnHidePopup() { | |
1498 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | |
1499 if (view) | |
1500 view->HidePopupMenu(); | |
1501 } | |
1502 #endif | |
1503 | |
1504 void RenderViewHostImpl::SetState(RenderViewHostImplState rvh_state) { | 1453 void RenderViewHostImpl::SetState(RenderViewHostImplState rvh_state) { |
1505 // We update the number of RenderViews in a SiteInstance when the | 1454 // We update the number of RenderViews in a SiteInstance when the |
1506 // swapped out status of this RenderView gets flipped to/from live. | 1455 // swapped out status of this RenderView gets flipped to/from live. |
1507 if (!IsRVHStateActive(rvh_state_) && IsRVHStateActive(rvh_state)) | 1456 if (!IsRVHStateActive(rvh_state_) && IsRVHStateActive(rvh_state)) |
1508 instance_->increment_active_view_count(); | 1457 instance_->increment_active_view_count(); |
1509 else if (IsRVHStateActive(rvh_state_) && !IsRVHStateActive(rvh_state)) | 1458 else if (IsRVHStateActive(rvh_state_) && !IsRVHStateActive(rvh_state)) |
1510 instance_->decrement_active_view_count(); | 1459 instance_->decrement_active_view_count(); |
1511 | 1460 |
1512 // Whenever we change the RVH state to and from live or swapped out state, we | 1461 // Whenever we change the RVH state to and from live or swapped out state, we |
1513 // should not be waiting for beforeunload or unload acks. We clear them here | 1462 // should not be waiting for beforeunload or unload acks. We clear them here |
(...skipping 26 matching lines...) Expand all Loading... |
1540 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1489 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1541 | 1490 |
1542 frame_tree->ResetForMainFrameSwap(); | 1491 frame_tree->ResetForMainFrameSwap(); |
1543 } | 1492 } |
1544 | 1493 |
1545 void RenderViewHostImpl::SelectWordAroundCaret() { | 1494 void RenderViewHostImpl::SelectWordAroundCaret() { |
1546 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1495 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1547 } | 1496 } |
1548 | 1497 |
1549 } // namespace content | 1498 } // namespace content |
OLD | NEW |