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

Side by Side Diff: chrome/browser/chromeos/network_state_notifier.cc

Issue 3031016: Increase network state change notification delay to 2seconds. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/network_state_notifier.h" 5 #include "chrome/browser/chromeos/network_state_notifier.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 NetworkStateNotifier::NetworkStateNotifier() 33 NetworkStateNotifier::NetworkStateNotifier()
34 : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), 34 : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
35 state_(RetrieveState()), 35 state_(RetrieveState()),
36 offline_start_time_(Time::Now()) { 36 offline_start_time_(Time::Now()) {
37 } 37 }
38 38
39 void NetworkStateNotifier::NetworkChanged(NetworkLibrary* cros) { 39 void NetworkStateNotifier::NetworkChanged(NetworkLibrary* cros) {
40 DCHECK(CrosLibrary::Get()->EnsureLoaded()); 40 DCHECK(CrosLibrary::Get()->EnsureLoaded());
41 // Update the state 1 seconds later using UI thread. 41 // Update the state 2 seconds later using UI thread.
42 // See http://crosbug.com/4558 42 // See http://crosbug.com/4558
43 ChromeThread::PostDelayedTask( 43 ChromeThread::PostDelayedTask(
44 ChromeThread::UI, FROM_HERE, 44 ChromeThread::UI, FROM_HERE,
45 task_factory_.NewRunnableMethod( 45 task_factory_.NewRunnableMethod(
46 &NetworkStateNotifier::UpdateNetworkState, 46 &NetworkStateNotifier::UpdateNetworkState,
47 RetrieveState()), 47 RetrieveState()),
48 1000); 48 2000);
49 } 49 }
50 50
51 void NetworkStateNotifier::UpdateNetworkState( 51 void NetworkStateNotifier::UpdateNetworkState(
52 NetworkStateDetails::State new_state) { 52 NetworkStateDetails::State new_state) {
53 DLOG(INFO) << "UpdateNetworkState: new=" 53 DLOG(INFO) << "UpdateNetworkState: new="
54 << new_state << ", old=" << state_; 54 << new_state << ", old=" << state_;
55 if (state_ == NetworkStateDetails::CONNECTED && 55 if (state_ == NetworkStateDetails::CONNECTED &&
56 new_state != NetworkStateDetails::CONNECTED) { 56 new_state != NetworkStateDetails::CONNECTED) {
57 offline_start_time_ = Time::Now(); 57 offline_start_time_ = Time::Now();
58 } 58 }
(...skipping 16 matching lines...) Expand all
75 return NetworkStateDetails::CONNECTED; 75 return NetworkStateDetails::CONNECTED;
76 } else if (cros->Connecting()) { 76 } else if (cros->Connecting()) {
77 return NetworkStateDetails::CONNECTING; 77 return NetworkStateDetails::CONNECTING;
78 } else { 78 } else {
79 return NetworkStateDetails::DISCONNECTED; 79 return NetworkStateDetails::DISCONNECTED;
80 } 80 }
81 } 81 }
82 82
83 83
84 } // namespace chromeos 84 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698