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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) | 547 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) |
548 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 548 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
549 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, | 549 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, |
550 OnFirstVisuallyNonEmptyPaint) | 550 OnFirstVisuallyNonEmptyPaint) |
551 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 551 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
552 OnShowValidationMessage) | 552 OnShowValidationMessage) |
553 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 553 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
554 OnHideValidationMessage) | 554 OnHideValidationMessage) |
555 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 555 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
556 OnMoveValidationMessage) | 556 OnMoveValidationMessage) |
| 557 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFrameName, OnUpdateFrameName) |
557 #if defined(OS_ANDROID) | 558 #if defined(OS_ANDROID) |
558 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | 559 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, |
559 OnFindMatchRectsReply) | 560 OnFindMatchRectsReply) |
560 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 561 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
561 OnOpenDateTimeDialog) | 562 OnOpenDateTimeDialog) |
562 #endif | 563 #endif |
563 IPC_MESSAGE_UNHANDLED(handled = false) | 564 IPC_MESSAGE_UNHANDLED(handled = false) |
564 IPC_END_MESSAGE_MAP() | 565 IPC_END_MESSAGE_MAP() |
565 render_view_message_source_ = NULL; | 566 render_view_message_source_ = NULL; |
566 render_frame_message_source_ = NULL; | 567 render_frame_message_source_ = NULL; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 627 |
627 RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { | 628 RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { |
628 RenderViewHostImpl* host = GetRenderManager()->current_host(); | 629 RenderViewHostImpl* host = GetRenderManager()->current_host(); |
629 return host ? host->GetProcess() : NULL; | 630 return host ? host->GetProcess() : NULL; |
630 } | 631 } |
631 | 632 |
632 RenderFrameHost* WebContentsImpl::GetMainFrame() { | 633 RenderFrameHost* WebContentsImpl::GetMainFrame() { |
633 return frame_tree_.root()->current_frame_host(); | 634 return frame_tree_.root()->current_frame_host(); |
634 } | 635 } |
635 | 636 |
| 637 void WebContentsImpl::SetMainFrameName(const std::string& name) { |
| 638 Send(new ViewMsg_SetName(GetRoutingID(), name)); |
| 639 } |
| 640 |
636 RenderFrameHost* WebContentsImpl::GetFocusedFrame() { | 641 RenderFrameHost* WebContentsImpl::GetFocusedFrame() { |
637 if (!frame_tree_.GetFocusedFrame()) | 642 if (!frame_tree_.GetFocusedFrame()) |
638 return NULL; | 643 return NULL; |
639 return frame_tree_.GetFocusedFrame()->current_frame_host(); | 644 return frame_tree_.GetFocusedFrame()->current_frame_host(); |
640 } | 645 } |
641 | 646 |
642 void WebContentsImpl::ForEachFrame( | 647 void WebContentsImpl::ForEachFrame( |
643 const base::Callback<void(RenderFrameHost*)>& on_frame) { | 648 const base::Callback<void(RenderFrameHost*)>& on_frame) { |
644 frame_tree_.ForEach(base::Bind(&ForEachFrameInternal, on_frame)); | 649 frame_tree_.ForEach(base::Bind(&ForEachFrameInternal, on_frame)); |
645 } | 650 } |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 if (delegate_) | 1673 if (delegate_) |
1669 delegate_->HideValidationMessage(this); | 1674 delegate_->HideValidationMessage(this); |
1670 } | 1675 } |
1671 | 1676 |
1672 void WebContentsImpl::OnMoveValidationMessage( | 1677 void WebContentsImpl::OnMoveValidationMessage( |
1673 const gfx::Rect& anchor_in_root_view) { | 1678 const gfx::Rect& anchor_in_root_view) { |
1674 if (delegate_) | 1679 if (delegate_) |
1675 delegate_->MoveValidationMessage(this, anchor_in_root_view); | 1680 delegate_->MoveValidationMessage(this, anchor_in_root_view); |
1676 } | 1681 } |
1677 | 1682 |
| 1683 void WebContentsImpl::OnUpdateFrameName(int render_frame_id, |
| 1684 bool is_top_level, |
| 1685 const std::string& name) { |
| 1686 if (delegate_) |
| 1687 delegate_->FrameNameChanged(render_frame_id, is_top_level, name); |
| 1688 } |
| 1689 |
1678 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) { | 1690 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) { |
1679 if (browser_plugin_embedder_) | 1691 if (browser_plugin_embedder_) |
1680 browser_plugin_embedder_->DidSendScreenRects(); | 1692 browser_plugin_embedder_->DidSendScreenRects(); |
1681 } | 1693 } |
1682 | 1694 |
1683 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 1695 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
1684 const gfx::Size old_size = GetPreferredSize(); | 1696 const gfx::Size old_size = GetPreferredSize(); |
1685 preferred_size_ = pref_size; | 1697 preferred_size_ = pref_size; |
1686 OnPreferredSizeChanged(old_size); | 1698 OnPreferredSizeChanged(old_size); |
1687 } | 1699 } |
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4070 | 4082 |
4071 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4083 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
4072 if (!delegate_) | 4084 if (!delegate_) |
4073 return; | 4085 return; |
4074 const gfx::Size new_size = GetPreferredSize(); | 4086 const gfx::Size new_size = GetPreferredSize(); |
4075 if (new_size != old_size) | 4087 if (new_size != old_size) |
4076 delegate_->UpdatePreferredSize(this, new_size); | 4088 delegate_->UpdatePreferredSize(this, new_size); |
4077 } | 4089 } |
4078 | 4090 |
4079 } // namespace content | 4091 } // namespace content |
OLD | NEW |