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

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

Issue 7241021: Revert 90359 - 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 // OnCloseStarted isn't called in unit tests. 247 // OnCloseStarted isn't called in unit tests.
248 if (!tab_close_start_time_.is_null()) { 248 if (!tab_close_start_time_.is_null()) {
249 UMA_HISTOGRAM_TIMES("Tab.Close", 249 UMA_HISTOGRAM_TIMES("Tab.Close",
250 base::TimeTicks::Now() - tab_close_start_time_); 250 base::TimeTicks::Now() - tab_close_start_time_);
251 } 251 }
252 252
253 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); 253 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed());
254 254
255 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); 255 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
256
257 set_delegate(NULL);
258 }
259
260 // TODO(cbentzel): Either remove the debugging code, or rename to SetDelegate.
261 void TabContents::set_delegate(TabContentsDelegate* delegate) {
262 if (delegate == delegate_)
263 return;
264 if (delegate_)
265 delegate_->Detach(this);
266 delegate_ = delegate;
267 if (delegate_)
268 delegate_->Attach(this);
269 } 256 }
270 257
271 void TabContents::AddObservers() { 258 void TabContents::AddObservers() {
272 net::NetworkChangeNotifier::AddOnlineStateObserver(this); 259 net::NetworkChangeNotifier::AddOnlineStateObserver(this);
273 } 260 }
274 261
275 bool TabContents::OnMessageReceived(const IPC::Message& message) { 262 bool TabContents::OnMessageReceived(const IPC::Message& message) {
276 if (web_ui() && web_ui()->OnMessageReceived(message)) 263 if (web_ui() && web_ui()->OnMessageReceived(message))
277 return true; 264 return true;
278 265
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 1837
1851 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1838 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1852 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1839 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1853 rwh_view->SetSize(view()->GetContainerSize()); 1840 rwh_view->SetSize(view()->GetContainerSize());
1854 } 1841 }
1855 1842
1856 void TabContents::OnOnlineStateChanged(bool online) { 1843 void TabContents::OnOnlineStateChanged(bool online) {
1857 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 1844 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
1858 render_view_host()->routing_id(), online)); 1845 render_view_host()->routing_id(), online));
1859 } 1846 }
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