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 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 | 3613 |
3612 #if defined(OS_ANDROID) | 3614 #if defined(OS_ANDROID) |
3613 void WebContentsImpl::OnFindMatchRectsReply( | 3615 void WebContentsImpl::OnFindMatchRectsReply( |
3614 int version, | 3616 int version, |
3615 const std::vector<gfx::RectF>& rects, | 3617 const std::vector<gfx::RectF>& rects, |
3616 const gfx::RectF& active_rect) { | 3618 const gfx::RectF& active_rect) { |
3617 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( | 3619 GetOrCreateFindRequestManager()->OnFindMatchRectsReply( |
3618 render_frame_message_source_, version, rects, active_rect); | 3620 render_frame_message_source_, version, rects, active_rect); |
3619 } | 3621 } |
3620 | 3622 |
| 3623 void WebContentsImpl::OnGetNearestFindResultReply(int request_id, |
| 3624 float distance) { |
| 3625 GetOrCreateFindRequestManager()->OnGetNearestFindResultReply( |
| 3626 render_frame_message_source_, request_id, distance); |
| 3627 } |
| 3628 |
3621 void WebContentsImpl::OnOpenDateTimeDialog( | 3629 void WebContentsImpl::OnOpenDateTimeDialog( |
3622 const ViewHostMsg_DateTimeDialogValue_Params& value) { | 3630 const ViewHostMsg_DateTimeDialogValue_Params& value) { |
3623 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), | 3631 date_time_chooser_->ShowDialog(GetTopLevelNativeWindow(), |
3624 GetRenderViewHost(), | 3632 GetRenderViewHost(), |
3625 value.dialog_type, | 3633 value.dialog_type, |
3626 value.dialog_value, | 3634 value.dialog_value, |
3627 value.minimum, | 3635 value.minimum, |
3628 value.maximum, | 3636 value.maximum, |
3629 value.step, | 3637 value.step, |
3630 value.suggestions); | 3638 value.suggestions); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4978 if (controller) { | 4986 if (controller) { |
4979 web_ui->AddMessageHandler(new GenericHandler()); | 4987 web_ui->AddMessageHandler(new GenericHandler()); |
4980 web_ui->SetController(controller); | 4988 web_ui->SetController(controller); |
4981 return web_ui; | 4989 return web_ui; |
4982 } | 4990 } |
4983 | 4991 |
4984 delete web_ui; | 4992 delete web_ui; |
4985 return NULL; | 4993 return NULL; |
4986 } | 4994 } |
4987 | 4995 |
| 4996 // TODO(paulmeyer): This method will not be used until find-in-page across |
| 4997 // GuestViews is implemented. |
| 4998 WebContentsImpl* WebContentsImpl::GetOutermostWebContents() { |
| 4999 // Find the outer-most WebContents. |
| 5000 WebContentsImpl* outermost_web_contents = this; |
| 5001 while (outermost_web_contents->node_ && |
| 5002 outermost_web_contents->node_->outer_web_contents()) { |
| 5003 outermost_web_contents = |
| 5004 outermost_web_contents->node_->outer_web_contents(); |
| 5005 } |
| 5006 return outermost_web_contents; |
| 5007 } |
| 5008 |
4988 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { | 5009 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { |
4989 // TODO(paulmeyer): This method will need to access (or potentially create) | 5010 // TODO(paulmeyer): This method will need to access (or potentially create) |
4990 // the FindRequestManager in the outermost WebContents once find-in-page | 5011 // the FindRequestManager in the outermost WebContents once find-in-page |
4991 // across GuestViews is implemented. | 5012 // across GuestViews is implemented. |
4992 if (!find_request_manager_) | 5013 if (!find_request_manager_) |
4993 find_request_manager_.reset(new FindRequestManager(this)); | 5014 find_request_manager_.reset(new FindRequestManager(this)); |
4994 | 5015 |
4995 return find_request_manager_.get(); | 5016 return find_request_manager_.get(); |
4996 } | 5017 } |
4997 | 5018 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5070 for (RenderViewHost* render_view_host : render_view_host_set) | 5091 for (RenderViewHost* render_view_host : render_view_host_set) |
5071 render_view_host->OnWebkitPreferencesChanged(); | 5092 render_view_host->OnWebkitPreferencesChanged(); |
5072 } | 5093 } |
5073 | 5094 |
5074 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5095 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
5075 JavaScriptDialogManager* dialog_manager) { | 5096 JavaScriptDialogManager* dialog_manager) { |
5076 dialog_manager_ = dialog_manager; | 5097 dialog_manager_ = dialog_manager; |
5077 } | 5098 } |
5078 | 5099 |
5079 } // namespace content | 5100 } // namespace content |
OLD | NEW |