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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 697 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
698 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 698 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
699 OnShowValidationMessage) | 699 OnShowValidationMessage) |
700 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 700 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
701 OnHideValidationMessage) | 701 OnHideValidationMessage) |
702 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 702 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
703 OnMoveValidationMessage) | 703 OnMoveValidationMessage) |
704 #if defined(OS_ANDROID) | 704 #if defined(OS_ANDROID) |
705 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, | 705 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, |
706 OnFindMatchRectsReply) | 706 OnFindMatchRectsReply) |
| 707 IPC_MESSAGE_HANDLER(FrameHostMsg_GetNearestFindResult_Reply, |
| 708 OnGetNearestFindResultReply) |
707 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 709 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
708 OnOpenDateTimeDialog) | 710 OnOpenDateTimeDialog) |
709 #endif | 711 #endif |
710 IPC_MESSAGE_UNHANDLED(handled = false) | 712 IPC_MESSAGE_UNHANDLED(handled = false) |
711 IPC_END_MESSAGE_MAP() | 713 IPC_END_MESSAGE_MAP() |
712 render_view_message_source_ = NULL; | 714 render_view_message_source_ = NULL; |
713 render_frame_message_source_ = NULL; | 715 render_frame_message_source_ = NULL; |
714 | 716 |
715 return handled; | 717 return handled; |
716 } | 718 } |
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3583 | 3585 |
3584 #if defined(OS_ANDROID) | 3586 #if defined(OS_ANDROID) |
3585 void WebContentsImpl::OnFindMatchRectsReply( | 3587 void WebContentsImpl::OnFindMatchRectsReply( |
3586 int version, | 3588 int version, |
3587 const std::vector<gfx::RectF>& rects, | 3589 const std::vector<gfx::RectF>& rects, |
3588 const gfx::RectF& active_rect) { | 3590 const gfx::RectF& active_rect) { |
3589 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( | 3591 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( |
3590 render_frame_message_source_, version, rects, active_rect); | 3592 render_frame_message_source_, version, rects, active_rect); |
3591 } | 3593 } |
3592 | 3594 |
| 3595 void WebContentsImpl::OnGetNearestFindResultReply(int request_id, |
| 3596 float distance) { |
| 3597 GetOrCreateFindRequestManager()->GetNearestFindResultReply( |
| 3598 render_frame_message_source_, request_id, distance); |
| 3599 } |
| 3600 |
3593 void WebContentsImpl::OnOpenDateTimeDialog( | 3601 void WebContentsImpl::OnOpenDateTimeDialog( |
3594 const ViewHostMsg_DateTimeDialogValue_Params& value) { | 3602 const ViewHostMsg_DateTimeDialogValue_Params& value) { |
3595 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), | 3603 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), |
3596 GetRenderViewHost(), | 3604 GetRenderViewHost(), |
3597 value.dialog_type, | 3605 value.dialog_type, |
3598 value.dialog_value, | 3606 value.dialog_value, |
3599 value.minimum, | 3607 value.minimum, |
3600 value.maximum, | 3608 value.maximum, |
3601 value.step, | 3609 value.step, |
3602 value.suggestions); | 3610 value.suggestions); |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4941 if (controller) { | 4949 if (controller) { |
4942 web_ui->AddMessageHandler(new GenericHandler()); | 4950 web_ui->AddMessageHandler(new GenericHandler()); |
4943 web_ui->SetController(controller); | 4951 web_ui->SetController(controller); |
4944 return web_ui; | 4952 return web_ui; |
4945 } | 4953 } |
4946 | 4954 |
4947 delete web_ui; | 4955 delete web_ui; |
4948 return NULL; | 4956 return NULL; |
4949 } | 4957 } |
4950 | 4958 |
| 4959 // TODO(paulmeyer): This method will not be used until find-in-page across |
| 4960 // GuestViews is implemented. |
| 4961 WebContentsImpl* WebContentsImpl::GetOutermostWebContents() { |
| 4962 // Find the outer-most WebContents. |
| 4963 WebContentsImpl* outermost_web_contents = this; |
| 4964 while (outermost_web_contents->node_ && |
| 4965 outermost_web_contents->node_->outer_web_contents()) { |
| 4966 outermost_web_contents = |
| 4967 outermost_web_contents->node_->outer_web_contents(); |
| 4968 } |
| 4969 return outermost_web_contents; |
| 4970 } |
| 4971 |
4951 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { | 4972 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { |
4952 // TODO(paulmeyer): This method will need to access (or potentially create) | 4973 // TODO(paulmeyer): This method will need to access (or potentially create) |
4953 // the FindRequestManager in the outermost WebContents once find-in-page | 4974 // the FindRequestManager in the outermost WebContents once find-in-page |
4954 // across GuestViews is implemented. | 4975 // across GuestViews is implemented. |
4955 if (!find_request_manager_) | 4976 if (!find_request_manager_) |
4956 find_request_manager_.reset(new FindRequestManager(this)); | 4977 find_request_manager_.reset(new FindRequestManager(this)); |
4957 | 4978 |
4958 return find_request_manager_.get(); | 4979 return find_request_manager_.get(); |
4959 } | 4980 } |
4960 | 4981 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5033 for (RenderViewHost* render_view_host : render_view_host_set) | 5054 for (RenderViewHost* render_view_host : render_view_host_set) |
5034 render_view_host->OnWebkitPreferencesChanged(); | 5055 render_view_host->OnWebkitPreferencesChanged(); |
5035 } | 5056 } |
5036 | 5057 |
5037 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5058 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
5038 JavaScriptDialogManager* dialog_manager) { | 5059 JavaScriptDialogManager* dialog_manager) { |
5039 dialog_manager_ = dialog_manager; | 5060 dialog_manager_ = dialog_manager; |
5040 } | 5061 } |
5041 | 5062 |
5042 } // namespace content | 5063 } // namespace content |
OLD | NEW |