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 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 | 3600 |
3595 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3601 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3596 if (!delegate_) | 3602 if (!delegate_) |
3597 return; | 3603 return; |
3598 const gfx::Size new_size = GetPreferredSize(); | 3604 const gfx::Size new_size = GetPreferredSize(); |
3599 if (new_size != old_size) | 3605 if (new_size != old_size) |
3600 delegate_->UpdatePreferredSize(this, new_size); | 3606 delegate_->UpdatePreferredSize(this, new_size); |
3601 } | 3607 } |
3602 | 3608 |
3603 } // namespace content | 3609 } // namespace content |
OLD | NEW |