Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 7244009: Helper functions for tracking stale TabContentsDelegate's. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 WindowOpenDisposition disposition, 616 WindowOpenDisposition disposition,
617 const gfx::Rect& initial_pos, 617 const gfx::Rect& initial_pos,
618 bool user_gesture) { 618 bool user_gesture) {
619 if (!delegate_) 619 if (!delegate_)
620 return; 620 return;
621 621
622 delegate_->AddNewContents(this, new_contents, disposition, initial_pos, 622 delegate_->AddNewContents(this, new_contents, disposition, initial_pos,
623 user_gesture); 623 user_gesture);
624 } 624 }
625 625
626 void TabContents::set_delegate(TabContentsDelegate* delegate) {
627 if (delegate == delegate_)
628 return;
629
630 if (delegate_)
631 delegate_->Detach(this);
632
633 delegate_ = delegate;
634
635 if (delegate_)
636 delegate_->Attach(this);
637 }
638
626 gfx::NativeView TabContents::GetContentNativeView() const { 639 gfx::NativeView TabContents::GetContentNativeView() const {
627 return view_->GetContentNativeView(); 640 return view_->GetContentNativeView();
628 } 641 }
629 642
630 gfx::NativeView TabContents::GetNativeView() const { 643 gfx::NativeView TabContents::GetNativeView() const {
631 return view_->GetNativeView(); 644 return view_->GetNativeView();
632 } 645 }
633 646
634 void TabContents::GetContainerBounds(gfx::Rect *out) const { 647 void TabContents::GetContainerBounds(gfx::Rect *out) const {
635 view_->GetContainerBounds(out); 648 view_->GetContainerBounds(out);
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 1851
1839 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1852 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1840 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1853 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1841 rwh_view->SetSize(view()->GetContainerSize()); 1854 rwh_view->SetSize(view()->GetContainerSize());
1842 } 1855 }
1843 1856
1844 void TabContents::OnOnlineStateChanged(bool online) { 1857 void TabContents::OnOnlineStateChanged(bool online) {
1845 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 1858 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
1846 render_view_host()->routing_id(), online)); 1859 render_view_host()->routing_id(), online));
1847 } 1860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698