Chromium Code Reviews| 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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 918 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 918 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
| 919 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 919 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
| 920 OnPpapiBrokerChannelCreated) | 920 OnPpapiBrokerChannelCreated) |
| 921 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 921 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
| 922 OnGetAllSavableResourceLinksForCurrentPage) | 922 OnGetAllSavableResourceLinksForCurrentPage) |
| 923 IPC_MESSAGE_HANDLER( | 923 IPC_MESSAGE_HANDLER( |
| 924 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 924 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
| 925 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 925 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
| 926 #if defined(OS_MACOSX) | 926 #if defined(OS_MACOSX) |
| 927 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 927 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 928 #elif defined(OS_ANDROID) | |
| 929 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | |
| 928 #endif | 930 #endif |
| 929 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 931 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 930 // TODO(viettrungluu): Move to a separate message filter. | 932 // TODO(viettrungluu): Move to a separate message filter. |
| 931 #if defined(OS_MACOSX) | 933 #if defined(OS_MACOSX) |
| 932 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 934 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 933 #endif | 935 #endif |
| 934 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 936 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 935 OnSetHistoryLengthAndPrune) | 937 OnSetHistoryLengthAndPrune) |
| 936 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 938 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 937 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 939 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1625 | 1627 |
| 1626 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { | 1628 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { |
| 1627 RenderWidget* widget = | 1629 RenderWidget* widget = |
| 1628 RenderWidget::Create(routing_id_, popup_type, screen_info_); | 1630 RenderWidget::Create(routing_id_, popup_type, screen_info_); |
| 1629 return widget->webwidget(); | 1631 return widget->webwidget(); |
| 1630 } | 1632 } |
| 1631 | 1633 |
| 1632 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( | 1634 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( |
| 1633 const WebPopupMenuInfo& popup_menu_info, | 1635 const WebPopupMenuInfo& popup_menu_info, |
| 1634 WebExternalPopupMenuClient* popup_menu_client) { | 1636 WebExternalPopupMenuClient* popup_menu_client) { |
| 1637 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. | |
| 1635 DCHECK(!external_popup_menu_.get()); | 1638 DCHECK(!external_popup_menu_.get()); |
| 1636 external_popup_menu_.reset( | 1639 external_popup_menu_.reset( |
| 1637 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 1640 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
| 1638 return external_popup_menu_.get(); | 1641 return external_popup_menu_.get(); |
| 1639 } | 1642 } |
| 1640 | 1643 |
| 1641 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( | 1644 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( |
| 1642 webkit::ppapi::PluginInstance* plugin) { | 1645 webkit::ppapi::PluginInstance* plugin) { |
| 1643 GURL active_url; | 1646 GURL active_url; |
| 1644 if (webview() && webview()->mainFrame()) | 1647 if (webview() && webview()->mainFrame()) |
| (...skipping 3801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5446 // If you hit this please file a bug against jcivelli and include the page | 5449 // If you hit this please file a bug against jcivelli and include the page |
| 5447 // and steps to repro. | 5450 // and steps to repro. |
| 5448 NOTREACHED(); | 5451 NOTREACHED(); |
| 5449 return; | 5452 return; |
| 5450 } | 5453 } |
| 5451 external_popup_menu_->DidSelectItem(selected_index); | 5454 external_popup_menu_->DidSelectItem(selected_index); |
| 5452 external_popup_menu_.reset(); | 5455 external_popup_menu_.reset(); |
| 5453 } | 5456 } |
| 5454 #endif | 5457 #endif |
| 5455 | 5458 |
| 5459 #if defined(OS_ANDROID) | |
| 5460 void RenderViewImpl::OnSelectPopupMenuItems(bool canceled, | |
| 5461 std::vector<int> selected_indices) { | |
|
Avi (use Gerrit)
2012/05/24 18:41:41
const std::vector<int>& ?
aruslan
2012/05/24 19:53:15
Done.
| |
| 5462 // It is possible to receive more than one of these calls if the user presses | |
| 5463 // a select faster than it takes for the show-select-popup IPC message to make | |
| 5464 // it to the browser UI thread. Ignore the extra-messages. | |
| 5465 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. | |
| 5466 if (!external_popup_menu_.get()) | |
| 5467 return; | |
| 5468 | |
| 5469 external_popup_menu_->DidSelectItems(canceled, selected_indices); | |
| 5470 external_popup_menu_.reset(); | |
| 5471 } | |
| 5472 #endif | |
| 5473 | |
| 5456 void RenderViewImpl::OnContextMenuClosed( | 5474 void RenderViewImpl::OnContextMenuClosed( |
| 5457 const content::CustomContextMenuContext& custom_context) { | 5475 const content::CustomContextMenuContext& custom_context) { |
| 5458 if (custom_context.is_pepper_menu) | 5476 if (custom_context.is_pepper_menu) |
| 5459 pepper_delegate_.OnContextMenuClosed(custom_context); | 5477 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5460 else | 5478 else |
| 5461 context_menu_node_.reset(); | 5479 context_menu_node_.reset(); |
| 5462 } | 5480 } |
| 5463 | 5481 |
| 5464 void RenderViewImpl::OnEnableViewSourceMode() { | 5482 void RenderViewImpl::OnEnableViewSourceMode() { |
| 5465 if (!webview()) | 5483 if (!webview()) |
| 5466 return; | 5484 return; |
| 5467 WebFrame* main_frame = webview()->mainFrame(); | 5485 WebFrame* main_frame = webview()->mainFrame(); |
| 5468 if (!main_frame) | 5486 if (!main_frame) |
| 5469 return; | 5487 return; |
| 5470 main_frame->enableViewSourceMode(true); | 5488 main_frame->enableViewSourceMode(true); |
| 5471 } | 5489 } |
| 5472 | 5490 |
| 5473 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5491 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5474 return !!RenderThreadImpl::current()->compositor_thread(); | 5492 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5475 } | 5493 } |
| 5476 | 5494 |
| 5477 void RenderViewImpl::OnJavaBridgeInit() { | 5495 void RenderViewImpl::OnJavaBridgeInit() { |
| 5478 DCHECK(!java_bridge_dispatcher_); | 5496 DCHECK(!java_bridge_dispatcher_); |
| 5479 #if defined(ENABLE_JAVA_BRIDGE) | 5497 #if defined(ENABLE_JAVA_BRIDGE) |
| 5480 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5498 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
| 5481 #endif | 5499 #endif |
| 5482 } | 5500 } |
| OLD | NEW |