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

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

Issue 5734002: Continuation of CL 5685007, rename the singleton accessor method in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 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 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_
6 #define CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_ 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/chromeos/cros/network_library.h" 9 #include "chrome/browser/chromeos/cros/network_library.h"
10 10
(...skipping 30 matching lines...) Expand all
41 DISALLOW_COPY_AND_ASSIGN(NetworkStateDetails); 41 DISALLOW_COPY_AND_ASSIGN(NetworkStateDetails);
42 }; 42 };
43 43
44 // NetworkStateNotifier sends notification when network state has 44 // NetworkStateNotifier sends notification when network state has
45 // chagned. Notification is sent in UI thread. 45 // chagned. Notification is sent in UI thread.
46 // TODO(oshima): port this to other platform. merge with 46 // TODO(oshima): port this to other platform. merge with
47 // NetworkChangeNotifier if possible. 47 // NetworkChangeNotifier if possible.
48 class NetworkStateNotifier : public NetworkLibrary::NetworkManagerObserver { 48 class NetworkStateNotifier : public NetworkLibrary::NetworkManagerObserver {
49 public: 49 public:
50 // Returns the singleton instance of the network state notifier; 50 // Returns the singleton instance of the network state notifier;
51 static NetworkStateNotifier* Get(); 51 static NetworkStateNotifier* GetInstance();
52 52
53 // The duration of being in offline. The value is undefined when 53 // The duration of being in offline. The value is undefined when
54 // when network is connected. 54 // when network is connected.
55 static base::TimeDelta GetOfflineDuration(); 55 static base::TimeDelta GetOfflineDuration();
56 56
57 // Returns true if the network is connected. 57 // Returns true if the network is connected.
58 static bool is_connected() { 58 static bool is_connected() {
59 return Get()->state_ == NetworkStateDetails::CONNECTED; 59 return GetInstance()->state_ == NetworkStateDetails::CONNECTED;
60 } 60 }
61 61
62 // NetworkLibrary::NetworkManagerObserver implementation. 62 // NetworkLibrary::NetworkManagerObserver implementation.
63 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); 63 virtual void OnNetworkManagerChanged(NetworkLibrary* cros);
64 64
65 private: 65 private:
66 friend struct DefaultSingletonTraits<NetworkStateNotifier>; 66 friend struct DefaultSingletonTraits<NetworkStateNotifier>;
67 67
68 // Retrieve the current state from libcros. 68 // Retrieve the current state from libcros.
69 static NetworkStateDetails::State RetrieveState(); 69 static NetworkStateDetails::State RetrieveState();
(...skipping 13 matching lines...) Expand all
83 83
84 // The start time of offline. 84 // The start time of offline.
85 base::Time offline_start_time_; 85 base::Time offline_start_time_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); 87 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier);
88 }; 88 };
89 89
90 } // namespace chromeos 90 } // namespace chromeos
91 91
92 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_ 92 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_STATE_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698