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

Side by Side Diff: chromeos/network/network_state.h

Issue 11192024: Add chromeos::NetworkStateManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to feedback Round 2 Created 8 years, 1 month 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_H_
6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_
7
8 #include "chromeos/network/managed_state.h"
9
10 namespace chromeos {
11
12 // Simple class to provide network state information about a network service.
13 // This class should always be passed as a const* and should never be held
14 // on to. Use path() (in ManagedState) for storing network identifiers and
gauravsh 2012/10/25 23:41:05 I don't understand the second path of the comment.
stevenjb 2012/10/26 21:36:39 Clarified.
15 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for
16 // the network.
17 class CHROMEOS_EXPORT NetworkState : public ManagedState {
18 public:
19 enum DataRemaining {
20 DATA_UNKNOWN,
21 DATA_NORMAL,
22 DATA_LOW,
23 DATA_VERY_LOW,
24 DATA_NONE
25 };
26
27 explicit NetworkState(const std::string& path);
28
29 // ManagedState overrides.
30 virtual bool PropertyChanged(const std::string& key,
31 const base::Value& value) OVERRIDE;
32
33 // Accessors
34 const std::string& name() const { return name_; }
35 const std::string& type() const { return type_; }
36 const std::string& security() const { return security_; }
37 const std::string& technology() const { return technology_; }
38 const std::string& ip_address() const { return ip_address_; }
39 const std::string& device_path() const { return device_path_; }
40 const std::string& state() const { return state_; }
41 const std::string& error() const { return error_; }
42 const std::string& activation() const { return activation_; }
43 const std::string& roaming() const { return roaming_; }
44 int strength() const { return strength_; }
45 DataRemaining data_left() const { return data_left_; }
46
47 bool IsConnectedState() const;
48 bool IsConnectingState() const;
49
50 // Helpers (used e.g. when a state is cached).
51 static bool StateIsConnected(const std::string& state);
52 static bool StateIsConnecting(const std::string& state);
53
54 private:
55 friend class NetworkStateHandler;
56
57 // Called by NetworkStateHandler when the ip config changes.
58 void set_ip_address(const std::string& ip_address) {
59 ip_address_ = ip_address;
60 }
61
62 // Network Service Properties
63 std::string name_;
64 std::string type_;
gauravsh 2012/10/25 23:41:05 Just like my comment in device_state.h, this would
stevenjb 2012/10/26 21:36:39 Done.
65 std::string security_;
66 std::string technology_;
67 std::string device_path_;
68 std::string ip_address_;
69 std::string state_;
70 std::string error_;
71 std::string activation_;
gauravsh 2012/10/25 23:41:05 What does this track? Should this be a bool? Shoul
stevenjb 2012/10/26 21:36:39 Renamed
72 std::string roaming_;
73 int strength_;
gauravsh 2012/10/25 23:41:05 signal_strength_ would be a better name.
stevenjb 2012/10/26 21:36:39 Done.
74 DataRemaining data_left_;
75
76 DISALLOW_COPY_AND_ASSIGN(NetworkState);
77 };
78
79 } // namespace chromeos
80
81 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698