| 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 if (params.guest_delegate) { | 523 if (params.guest_delegate) { |
| 524 // This makes |new_contents| act as a guest. | 524 // This makes |new_contents| act as a guest. |
| 525 // For more info, see comment above class BrowserPluginGuest. | 525 // For more info, see comment above class BrowserPluginGuest. |
| 526 BrowserPluginGuest::Create(new_contents, params.guest_delegate); | 526 BrowserPluginGuest::Create(new_contents, params.guest_delegate); |
| 527 // We are instantiating a WebContents for browser plugin. Set its subframe | 527 // We are instantiating a WebContents for browser plugin. Set its subframe |
| 528 // bit to true. | 528 // bit to true. |
| 529 new_contents->is_subframe_ = true; | 529 new_contents->is_subframe_ = true; |
| 530 } | 530 } |
| 531 new_contents->Init(params); | 531 new_contents->Init(params); |
| 532 |
| 532 return new_contents; | 533 return new_contents; |
| 533 } | 534 } |
| 534 | 535 |
| 535 // static | 536 // static |
| 536 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { | 537 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { |
| 537 std::vector<WebContentsImpl*> result; | 538 std::vector<WebContentsImpl*> result; |
| 538 scoped_ptr<RenderWidgetHostIterator> widgets( | 539 scoped_ptr<RenderWidgetHostIterator> widgets( |
| 539 RenderWidgetHostImpl::GetRenderWidgetHosts()); | 540 RenderWidgetHostImpl::GetRenderWidgetHosts()); |
| 540 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { | 541 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { |
| 541 RenderViewHost* rvh = RenderViewHost::From(rwh); | 542 RenderViewHost* rvh = RenderViewHost::From(rwh); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 NavigationEntry* entry = controller_.GetVisibleEntry(); | 711 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 711 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); | 712 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); |
| 712 } | 713 } |
| 713 | 714 |
| 714 const GURL& WebContentsImpl::GetLastCommittedURL() const { | 715 const GURL& WebContentsImpl::GetLastCommittedURL() const { |
| 715 // We may not have a navigation entry yet. | 716 // We may not have a navigation entry yet. |
| 716 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 717 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 717 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); | 718 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); |
| 718 } | 719 } |
| 719 | 720 |
| 721 const url::Origin& WebContentsImpl::GetLastCommittedOrigin() const { |
| 722 return frame_tree_.root()->current_replication_state().origin; |
| 723 } |
| 724 |
| 720 WebContentsDelegate* WebContentsImpl::GetDelegate() { | 725 WebContentsDelegate* WebContentsImpl::GetDelegate() { |
| 721 return delegate_; | 726 return delegate_; |
| 722 } | 727 } |
| 723 | 728 |
| 724 void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) { | 729 void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) { |
| 725 // TODO(cbentzel): remove this debugging code? | 730 // TODO(cbentzel): remove this debugging code? |
| 726 if (delegate == delegate_) | 731 if (delegate == delegate_) |
| 727 return; | 732 return; |
| 728 if (delegate_) | 733 if (delegate_) |
| 729 delegate_->Detach(this); | 734 delegate_->Detach(this); |
| (...skipping 3960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4690 return NULL; | 4695 return NULL; |
| 4691 } | 4696 } |
| 4692 | 4697 |
| 4693 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4698 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4694 force_disable_overscroll_content_ = force_disable; | 4699 force_disable_overscroll_content_ = force_disable; |
| 4695 if (view_) | 4700 if (view_) |
| 4696 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4701 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4697 } | 4702 } |
| 4698 | 4703 |
| 4699 } // namespace content | 4704 } // namespace content |
| OLD | NEW |