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

Side by Side Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.cc

Issue 7969009: Removed chromeos::NetworkStateNotifier and redirected all related code to use (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" 5 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
6 6
7 #include "base/task.h" 7 #include "base/task.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Delay for online change notification reporting. 13 // Delay for online change notification reporting.
14 const int kOnlineNotificationDelayMS = 500; 14 const int kOnlineNotificationDelayMS = 500;
15 const int kInitialNotificationCheckDelayMS = 1000;
15 16
16 bool IsOnline(chromeos::ConnectionState state) { 17 bool IsOnline(chromeos::ConnectionState state) {
17 return state == chromeos::STATE_ONLINE; 18 return state == chromeos::STATE_ONLINE ||
19 state == chromeos::STATE_PORTAL;
18 } 20 }
19 21
20 } 22 }
21 23
22 namespace chromeos { 24 namespace chromeos {
23 25
24 // Task for fetching tokens from UI thread. 26 // Task for fetching tokens from UI thread.
25 class OnlineStatusReportThreadTask : public CancelableTask { 27 class OnlineStatusReportThreadTask : public CancelableTask {
26 public: 28 public:
27 OnlineStatusReportThreadTask(NetworkChangeNotifierChromeos* parent, 29 OnlineStatusReportThreadTask(NetworkChangeNotifierChromeos* parent,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 online_notification_task_(NULL) { 64 online_notification_task_(NULL) {
63 65
64 chromeos::NetworkLibrary* net = 66 chromeos::NetworkLibrary* net =
65 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 67 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
66 net->AddNetworkManagerObserver(this); 68 net->AddNetworkManagerObserver(this);
67 69
68 chromeos::PowerLibrary* power = 70 chromeos::PowerLibrary* power =
69 chromeos::CrosLibrary::Get()->GetPowerLibrary(); 71 chromeos::CrosLibrary::Get()->GetPowerLibrary();
70 power->AddObserver(this); 72 power->AddObserver(this);
71 73
74 UpdateNetworkState(net);
72 BrowserThread::PostDelayedTask( 75 BrowserThread::PostDelayedTask(
73 BrowserThread::UI, FROM_HERE, 76 BrowserThread::UI, FROM_HERE,
74 NewRunnableFunction( 77 NewRunnableFunction(
75 &NetworkChangeNotifierChromeos::UpdateInitialState, this), 78 &NetworkChangeNotifierChromeos::UpdateInitialState, this),
76 kOnlineNotificationDelayMS); 79 kInitialNotificationCheckDelayMS);
77 } 80 }
78 81
79 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { 82 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() {
80 if (online_notification_task_) { 83 if (online_notification_task_) {
81 online_notification_task_->Cancel(); 84 online_notification_task_->Cancel();
82 online_notification_task_ = NULL; 85 online_notification_task_ = NULL;
83 } 86 }
84 if (!chromeos::CrosLibrary::Get()) 87 if (!chromeos::CrosLibrary::Get())
85 return; 88 return;
86 chromeos::NetworkLibrary* lib = 89 chromeos::NetworkLibrary* lib =
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 257
255 // static 258 // static
256 void NetworkChangeNotifierChromeos::UpdateInitialState( 259 void NetworkChangeNotifierChromeos::UpdateInitialState(
257 NetworkChangeNotifierChromeos* self) { 260 NetworkChangeNotifierChromeos* self) {
258 chromeos::NetworkLibrary* net = 261 chromeos::NetworkLibrary* net =
259 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 262 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
260 self->UpdateNetworkState(net); 263 self->UpdateNetworkState(net);
261 } 264 }
262 265
263 } // namespace net 266 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.cc ('k') | chrome/browser/chromeos/network_state_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698