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

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: Explicit constructor 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 // OnCloseStarted isn't called in unit tests. 248 // OnCloseStarted isn't called in unit tests.
249 if (!tab_close_start_time_.is_null()) { 249 if (!tab_close_start_time_.is_null()) {
250 UMA_HISTOGRAM_TIMES("Tab.Close", 250 UMA_HISTOGRAM_TIMES("Tab.Close",
251 base::TimeTicks::Now() - tab_close_start_time_); 251 base::TimeTicks::Now() - tab_close_start_time_);
252 } 252 }
253 253
254 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); 254 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed());
255 255
256 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); 256 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
257
258 set_delegate(NULL);
259 }
260
261 // TODO(cbentzel): Either remove the debugging code, or rename to SetDelegate.
262 void TabContents::set_delegate(TabContentsDelegate* delegate) {
263 if (delegate == delegate_)
264 return;
265 if (delegate_)
266 delegate_->Detach(this);
267 delegate_ = delegate;
268 if (delegate_)
269 delegate_->Attach(this);
257 } 270 }
258 271
259 void TabContents::AddObservers() { 272 void TabContents::AddObservers() {
260 net::NetworkChangeNotifier::AddOnlineStateObserver(this); 273 net::NetworkChangeNotifier::AddOnlineStateObserver(this);
261 } 274 }
262 275
263 bool TabContents::OnMessageReceived(const IPC::Message& message) { 276 bool TabContents::OnMessageReceived(const IPC::Message& message) {
264 if (web_ui() && web_ui()->OnMessageReceived(message)) 277 if (web_ui() && web_ui()->OnMessageReceived(message))
265 return true; 278 return true;
266 279
(...skipping 1571 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
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698