| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { | 578 RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { |
| 579 RenderViewHostImpl* host = GetRenderManager()->current_host(); | 579 RenderViewHostImpl* host = GetRenderManager()->current_host(); |
| 580 return host ? host->GetProcess() : NULL; | 580 return host ? host->GetProcess() : NULL; |
| 581 } | 581 } |
| 582 | 582 |
| 583 RenderFrameHost* WebContentsImpl::GetMainFrame() { | 583 RenderFrameHost* WebContentsImpl::GetMainFrame() { |
| 584 return frame_tree_.root()->current_frame_host(); | 584 return frame_tree_.root()->current_frame_host(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 RenderFrameHost* WebContentsImpl::GetFocusedFrame() { |
| 588 if (!frame_tree_.GetFocusedFrame()) |
| 589 return NULL; |
| 590 return frame_tree_.GetFocusedFrame()->current_frame_host(); |
| 591 } |
| 592 |
| 587 void WebContentsImpl::ForEachFrame( | 593 void WebContentsImpl::ForEachFrame( |
| 588 const base::Callback<void(RenderFrameHost*)>& on_frame) { | 594 const base::Callback<void(RenderFrameHost*)>& on_frame) { |
| 589 frame_tree_.ForEach(base::Bind(&ForEachFrameInternal, on_frame)); | 595 frame_tree_.ForEach(base::Bind(&ForEachFrameInternal, on_frame)); |
| 590 } | 596 } |
| 591 | 597 |
| 592 void WebContentsImpl::SendToAllFrames(IPC::Message* message) { | 598 void WebContentsImpl::SendToAllFrames(IPC::Message* message) { |
| 593 ForEachFrame(base::Bind(&SendToAllFramesInternal, message)); | 599 ForEachFrame(base::Bind(&SendToAllFramesInternal, message)); |
| 594 delete message; | 600 delete message; |
| 595 } | 601 } |
| 596 | 602 |
| (...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3605 | 3611 |
| 3606 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3612 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3607 if (!delegate_) | 3613 if (!delegate_) |
| 3608 return; | 3614 return; |
| 3609 const gfx::Size new_size = GetPreferredSize(); | 3615 const gfx::Size new_size = GetPreferredSize(); |
| 3610 if (new_size != old_size) | 3616 if (new_size != old_size) |
| 3611 delegate_->UpdatePreferredSize(this, new_size); | 3617 delegate_->UpdatePreferredSize(this, new_size); |
| 3612 } | 3618 } |
| 3613 | 3619 |
| 3614 } // namespace content | 3620 } // namespace content |
| OLD | NEW |