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

Unified Diff: content/browser/net/browser_online_state_observer.cc

Issue 7259004: Convert ViewMsg_NetworkStateChanged from routed -> control, allowing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux build 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/net/browser_online_state_observer.cc
diff --git a/content/browser/net/browser_online_state_observer.cc b/content/browser/net/browser_online_state_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2b0ccd843e58731ceb2033a437063e3195cdc907
--- /dev/null
+++ b/content/browser/net/browser_online_state_observer.cc
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/net/browser_online_state_observer.h"
+
+#include "content/browser/renderer_host/render_process_host.h"
+#include "content/common/view_messages.h"
+#include "net/base/network_change_notifier.h"
+
+BrowserOnlineStateObserver::BrowserOnlineStateObserver() {
+ net::NetworkChangeNotifier::AddOnlineStateObserver(this);
+}
+
+BrowserOnlineStateObserver::~BrowserOnlineStateObserver() {
+ net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
+}
+
+void BrowserOnlineStateObserver::OnOnlineStateChanged(bool online) {
+ for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged(online));
+ }
+}
« no previous file with comments | « content/browser/net/browser_online_state_observer.h ('k') | content/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698