| 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 699 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 700 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 700 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
| 701 OnShowValidationMessage) | 701 OnShowValidationMessage) |
| 702 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 702 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
| 703 OnHideValidationMessage) | 703 OnHideValidationMessage) |
| 704 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 704 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
| 705 OnMoveValidationMessage) | 705 OnMoveValidationMessage) |
| 706 #if defined(OS_ANDROID) | 706 #if defined(OS_ANDROID) |
| 707 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, | 707 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, |
| 708 OnFindMatchRectsReply) | 708 OnFindMatchRectsReply) |
| 709 IPC_MESSAGE_HANDLER(FrameHostMsg_GetNearestFindResult_Reply, |
| 710 OnGetNearestFindResultReply) |
| 709 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 711 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
| 710 OnOpenDateTimeDialog) | 712 OnOpenDateTimeDialog) |
| 711 #endif | 713 #endif |
| 712 IPC_MESSAGE_UNHANDLED(handled = false) | 714 IPC_MESSAGE_UNHANDLED(handled = false) |
| 713 IPC_END_MESSAGE_MAP() | 715 IPC_END_MESSAGE_MAP() |
| 714 render_view_message_source_ = NULL; | 716 render_view_message_source_ = NULL; |
| 715 render_frame_message_source_ = NULL; | 717 render_frame_message_source_ = NULL; |
| 716 | 718 |
| 717 return handled; | 719 return handled; |
| 718 } | 720 } |
| (...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 | 3590 |
| 3589 #if defined(OS_ANDROID) | 3591 #if defined(OS_ANDROID) |
| 3590 void WebContentsImpl::OnFindMatchRectsReply( | 3592 void WebContentsImpl::OnFindMatchRectsReply( |
| 3591 int version, | 3593 int version, |
| 3592 const std::vector<gfx::RectF>& rects, | 3594 const std::vector<gfx::RectF>& rects, |
| 3593 const gfx::RectF& active_rect) { | 3595 const gfx::RectF& active_rect) { |
| 3594 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( | 3596 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( |
| 3595 render_frame_message_source_, version, rects, active_rect); | 3597 render_frame_message_source_, version, rects, active_rect); |
| 3596 } | 3598 } |
| 3597 | 3599 |
| 3600 void WebContentsImpl::OnGetNearestFindResultReply(int request_id, |
| 3601 float distance) { |
| 3602 GetOrCreateFindRequestManager()->OnGetNearestFindResultReply( |
| 3603 render_frame_message_source_, request_id, distance); |
| 3604 } |
| 3605 |
| 3598 void WebContentsImpl::OnOpenDateTimeDialog( | 3606 void WebContentsImpl::OnOpenDateTimeDialog( |
| 3599 const ViewHostMsg_DateTimeDialogValue_Params& value) { | 3607 const ViewHostMsg_DateTimeDialogValue_Params& value) { |
| 3600 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), | 3608 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), |
| 3601 GetRenderViewHost(), | 3609 GetRenderViewHost(), |
| 3602 value.dialog_type, | 3610 value.dialog_type, |
| 3603 value.dialog_value, | 3611 value.dialog_value, |
| 3604 value.minimum, | 3612 value.minimum, |
| 3605 value.maximum, | 3613 value.maximum, |
| 3606 value.step, | 3614 value.step, |
| 3607 value.suggestions); | 3615 value.suggestions); |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4947 if (controller) { | 4955 if (controller) { |
| 4948 web_ui->AddMessageHandler(new GenericHandler()); | 4956 web_ui->AddMessageHandler(new GenericHandler()); |
| 4949 web_ui->SetController(controller); | 4957 web_ui->SetController(controller); |
| 4950 return web_ui; | 4958 return web_ui; |
| 4951 } | 4959 } |
| 4952 | 4960 |
| 4953 delete web_ui; | 4961 delete web_ui; |
| 4954 return NULL; | 4962 return NULL; |
| 4955 } | 4963 } |
| 4956 | 4964 |
| 4965 // TODO(paulmeyer): This method will not be used until find-in-page across |
| 4966 // GuestViews is implemented. |
| 4967 WebContentsImpl* WebContentsImpl::GetOutermostWebContents() { |
| 4968 // Find the outer-most WebContents. |
| 4969 WebContentsImpl* outermost_web_contents = this; |
| 4970 while (outermost_web_contents->node_ && |
| 4971 outermost_web_contents->node_->outer_web_contents()) { |
| 4972 outermost_web_contents = |
| 4973 outermost_web_contents->node_->outer_web_contents(); |
| 4974 } |
| 4975 return outermost_web_contents; |
| 4976 } |
| 4977 |
| 4957 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { | 4978 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { |
| 4958 // TODO(paulmeyer): This method will need to access (or potentially create) | 4979 // TODO(paulmeyer): This method will need to access (or potentially create) |
| 4959 // the FindRequestManager in the outermost WebContents once find-in-page | 4980 // the FindRequestManager in the outermost WebContents once find-in-page |
| 4960 // across GuestViews is implemented. | 4981 // across GuestViews is implemented. |
| 4961 if (!find_request_manager_) | 4982 if (!find_request_manager_) |
| 4962 find_request_manager_.reset(new FindRequestManager(this)); | 4983 find_request_manager_.reset(new FindRequestManager(this)); |
| 4963 | 4984 |
| 4964 return find_request_manager_.get(); | 4985 return find_request_manager_.get(); |
| 4965 } | 4986 } |
| 4966 | 4987 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5039 for (RenderViewHost* render_view_host : render_view_host_set) | 5060 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5040 render_view_host->OnWebkitPreferencesChanged(); | 5061 render_view_host->OnWebkitPreferencesChanged(); |
| 5041 } | 5062 } |
| 5042 | 5063 |
| 5043 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5064 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5044 JavaScriptDialogManager* dialog_manager) { | 5065 JavaScriptDialogManager* dialog_manager) { |
| 5045 dialog_manager_ = dialog_manager; | 5066 dialog_manager_ = dialog_manager; |
| 5046 } | 5067 } |
| 5047 | 5068 |
| 5048 } // namespace content | 5069 } // namespace content |
| OLD | NEW |