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

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

Issue 6526059: Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Appease the C++ type system Created 9 years, 9 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
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | jingle/notifier/communicator/login.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 #endif 389 #endif
390 390
391 // OnCloseStarted isn't called in unit tests. 391 // OnCloseStarted isn't called in unit tests.
392 if (!tab_close_start_time_.is_null()) { 392 if (!tab_close_start_time_.is_null()) {
393 UMA_HISTOGRAM_TIMES("Tab.Close", 393 UMA_HISTOGRAM_TIMES("Tab.Close",
394 base::TimeTicks::Now() - tab_close_start_time_); 394 base::TimeTicks::Now() - tab_close_start_time_);
395 } 395 }
396 396
397 FOR_EACH_OBSERVER(TabContentsObserver, observers_, set_tab_contents(NULL)); 397 FOR_EACH_OBSERVER(TabContentsObserver, observers_, set_tab_contents(NULL));
398
399 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
398 } 400 }
399 401
400 void TabContents::AddObservers() { 402 void TabContents::AddObservers() {
401 printing_.reset(new printing::PrintViewManager(this)); 403 printing_.reset(new printing::PrintViewManager(this));
402 print_preview_.reset(new printing::PrintPreviewMessageHandler(this)); 404 print_preview_.reset(new printing::PrintPreviewMessageHandler(this));
403 fav_icon_helper_.reset(new FavIconHelper(this)); 405 fav_icon_helper_.reset(new FavIconHelper(this));
404 autofill_manager_.reset(new AutoFillManager(this)); 406 autofill_manager_.reset(new AutoFillManager(this));
405 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); 407 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this));
406 prerender_plt_recorder_.reset(new prerender::PrerenderPLTRecorder(this)); 408 prerender_plt_recorder_.reset(new prerender::PrerenderPLTRecorder(this));
407 desktop_notification_handler_.reset( 409 desktop_notification_handler_.reset(
408 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); 410 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost()));
409 plugin_observer_.reset(new PluginObserver(this)); 411 plugin_observer_.reset(new PluginObserver(this));
410 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( 412 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost(
411 this)); 413 this));
414 net::NetworkChangeNotifier::AddOnlineStateObserver(this);
412 } 415 }
413 416
414 bool TabContents::OnMessageReceived(const IPC::Message& message) { 417 bool TabContents::OnMessageReceived(const IPC::Message& message) {
415 ObserverListBase<TabContentsObserver>::Iterator it(observers_); 418 ObserverListBase<TabContentsObserver>::Iterator it(observers_);
416 TabContentsObserver* observer; 419 TabContentsObserver* observer;
417 while ((observer = it.GetNext()) != NULL) 420 while ((observer = it.GetNext()) != NULL)
418 if (observer->OnMessageReceived(message)) 421 if (observer->OnMessageReceived(message))
419 return true; 422 return true;
420 423
421 bool handled = true; 424 bool handled = true;
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 2848
2846 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { 2849 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) {
2847 render_manager_.SwapInRenderViewHost(rvh); 2850 render_manager_.SwapInRenderViewHost(rvh);
2848 } 2851 }
2849 2852
2850 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2853 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2851 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2854 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2852 rwh_view->SetSize(view()->GetContainerSize()); 2855 rwh_view->SetSize(view()->GetContainerSize());
2853 } 2856 }
2854 2857
2858 void TabContents::OnOnlineStateChanged(bool online) {
2859 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2860 render_view_host()->routing_id(), online));
2861 }
2862
2855 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { 2863 bool TabContents::MaybeUsePreloadedPage(const GURL& url) {
2856 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); 2864 prerender::PrerenderManager* pm = profile()->GetPrerenderManager();
2857 if (pm != NULL) { 2865 if (pm != NULL) {
2858 if (pm->MaybeUsePreloadedPage(this, url)) 2866 if (pm->MaybeUsePreloadedPage(this, url))
2859 return true; 2867 return true;
2860 } 2868 }
2861 return false; 2869 return false;
2862 } 2870 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | jingle/notifier/communicator/login.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698