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

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 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
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_config() const { return ip_config_; }
pneubeck (no reviews) 2012/10/25 14:42:17 Which format has this? If this class is directly a
stevenjb 2012/10/25 22:05:22 You're absolutely correct, this should be ip_addre
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_config(const std::string& ip_config) {ip_config_ = ip_config; }
59
60 // Network Service Properties
61 std::string name_;
62 std::string type_;
63 std::string security_;
64 std::string technology_;
65 std::string device_path_;
66 std::string ip_config_;
67 std::string state_;
68 std::string error_;
69 std::string activation_;
70 std::string roaming_;
71 int strength_;
72 DataRemaining data_left_;
73
74 DISALLOW_COPY_AND_ASSIGN(NetworkState);
75 };
76
77 } // namespace chromeos
78
79 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698