| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 932 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
| 933 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 933 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
| 934 OnPpapiBrokerChannelCreated) | 934 OnPpapiBrokerChannelCreated) |
| 935 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 935 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
| 936 OnGetAllSavableResourceLinksForCurrentPage) | 936 OnGetAllSavableResourceLinksForCurrentPage) |
| 937 IPC_MESSAGE_HANDLER( | 937 IPC_MESSAGE_HANDLER( |
| 938 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 938 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
| 939 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 939 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
| 940 #if defined(OS_MACOSX) | 940 #if defined(OS_MACOSX) |
| 941 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 941 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 942 #elif defined(OS_ANDROID) |
| 943 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
| 942 #endif | 944 #endif |
| 943 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 945 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 944 // TODO(viettrungluu): Move to a separate message filter. | 946 // TODO(viettrungluu): Move to a separate message filter. |
| 945 #if defined(OS_MACOSX) | 947 #if defined(OS_MACOSX) |
| 946 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 948 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 947 #endif | 949 #endif |
| 948 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 950 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 949 OnSetHistoryLengthAndPrune) | 951 OnSetHistoryLengthAndPrune) |
| 950 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 952 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 951 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 953 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 | 1660 |
| 1659 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { | 1661 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { |
| 1660 RenderWidget* widget = | 1662 RenderWidget* widget = |
| 1661 RenderWidget::Create(routing_id_, popup_type, screen_info_); | 1663 RenderWidget::Create(routing_id_, popup_type, screen_info_); |
| 1662 return widget->webwidget(); | 1664 return widget->webwidget(); |
| 1663 } | 1665 } |
| 1664 | 1666 |
| 1665 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( | 1667 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( |
| 1666 const WebPopupMenuInfo& popup_menu_info, | 1668 const WebPopupMenuInfo& popup_menu_info, |
| 1667 WebExternalPopupMenuClient* popup_menu_client) { | 1669 WebExternalPopupMenuClient* popup_menu_client) { |
| 1670 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. |
| 1668 DCHECK(!external_popup_menu_.get()); | 1671 DCHECK(!external_popup_menu_.get()); |
| 1669 external_popup_menu_.reset( | 1672 external_popup_menu_.reset( |
| 1670 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 1673 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
| 1671 return external_popup_menu_.get(); | 1674 return external_popup_menu_.get(); |
| 1672 } | 1675 } |
| 1673 | 1676 |
| 1674 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( | 1677 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( |
| 1675 webkit::ppapi::PluginInstance* plugin) { | 1678 webkit::ppapi::PluginInstance* plugin) { |
| 1676 GURL active_url; | 1679 GURL active_url; |
| 1677 if (webview() && webview()->mainFrame()) | 1680 if (webview() && webview()->mainFrame()) |
| (...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5488 // If you hit this please file a bug against jcivelli and include the page | 5491 // If you hit this please file a bug against jcivelli and include the page |
| 5489 // and steps to repro. | 5492 // and steps to repro. |
| 5490 NOTREACHED(); | 5493 NOTREACHED(); |
| 5491 return; | 5494 return; |
| 5492 } | 5495 } |
| 5493 external_popup_menu_->DidSelectItem(selected_index); | 5496 external_popup_menu_->DidSelectItem(selected_index); |
| 5494 external_popup_menu_.reset(); | 5497 external_popup_menu_.reset(); |
| 5495 } | 5498 } |
| 5496 #endif | 5499 #endif |
| 5497 | 5500 |
| 5501 #if defined(OS_ANDROID) |
| 5502 void RenderViewImpl::OnSelectPopupMenuItems( |
| 5503 bool canceled, |
| 5504 const std::vector<int>& selected_indices) { |
| 5505 // It is possible to receive more than one of these calls if the user presses |
| 5506 // a select faster than it takes for the show-select-popup IPC message to make |
| 5507 // it to the browser UI thread. Ignore the extra-messages. |
| 5508 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. |
| 5509 if (!external_popup_menu_.get()) |
| 5510 return; |
| 5511 |
| 5512 external_popup_menu_->DidSelectItems(canceled, selected_indices); |
| 5513 external_popup_menu_.reset(); |
| 5514 } |
| 5515 #endif |
| 5516 |
| 5498 void RenderViewImpl::OnContextMenuClosed( | 5517 void RenderViewImpl::OnContextMenuClosed( |
| 5499 const content::CustomContextMenuContext& custom_context) { | 5518 const content::CustomContextMenuContext& custom_context) { |
| 5500 if (custom_context.is_pepper_menu) | 5519 if (custom_context.is_pepper_menu) |
| 5501 pepper_delegate_.OnContextMenuClosed(custom_context); | 5520 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5502 else | 5521 else |
| 5503 context_menu_node_.reset(); | 5522 context_menu_node_.reset(); |
| 5504 } | 5523 } |
| 5505 | 5524 |
| 5506 void RenderViewImpl::OnEnableViewSourceMode() { | 5525 void RenderViewImpl::OnEnableViewSourceMode() { |
| 5507 if (!webview()) | 5526 if (!webview()) |
| 5508 return; | 5527 return; |
| 5509 WebFrame* main_frame = webview()->mainFrame(); | 5528 WebFrame* main_frame = webview()->mainFrame(); |
| 5510 if (!main_frame) | 5529 if (!main_frame) |
| 5511 return; | 5530 return; |
| 5512 main_frame->enableViewSourceMode(true); | 5531 main_frame->enableViewSourceMode(true); |
| 5513 } | 5532 } |
| 5514 | 5533 |
| 5515 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5534 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5516 return !!RenderThreadImpl::current()->compositor_thread(); | 5535 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5517 } | 5536 } |
| 5518 | 5537 |
| 5519 void RenderViewImpl::OnJavaBridgeInit() { | 5538 void RenderViewImpl::OnJavaBridgeInit() { |
| 5520 DCHECK(!java_bridge_dispatcher_); | 5539 DCHECK(!java_bridge_dispatcher_); |
| 5521 #if defined(ENABLE_JAVA_BRIDGE) | 5540 #if defined(ENABLE_JAVA_BRIDGE) |
| 5522 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5541 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
| 5523 #endif | 5542 #endif |
| 5524 } | 5543 } |
| OLD | NEW |