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

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

Issue 12634019: NetworkChangeNotifierChromeos: Handle IPConfig property changes on the default network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 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 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 CHROMEOS_NETWORK_NETWORK_STATE_H_ 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_H_
6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ 6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_
7 7
8 #include <string>
9 #include <vector>
10
8 #include "chromeos/network/managed_state.h" 11 #include "chromeos/network/managed_state.h"
9 12
10 namespace base { 13 namespace base {
11 class DictionaryValue; 14 class DictionaryValue;
12 } 15 }
13 16
14 namespace chromeos { 17 namespace chromeos {
15 18
16 // Simple class to provide network state information about a network service. 19 // Simple class to provide network state information about a network service.
17 // This class should always be passed as a const* and should never be held 20 // This class should always be passed as a const* and should never be held
(...skipping 11 matching lines...) Expand all
29 const base::Value& value) OVERRIDE; 32 const base::Value& value) OVERRIDE;
30 33
31 // Fills |dictionary| with the state properties. All the properties that are 34 // Fills |dictionary| with the state properties. All the properties that are
32 // accepted by PropertyChanged are stored in |dictionary|, no other values are 35 // accepted by PropertyChanged are stored in |dictionary|, no other values are
33 // stored. 36 // stored.
34 void GetProperties(base::DictionaryValue* dictionary) const; 37 void GetProperties(base::DictionaryValue* dictionary) const;
35 38
36 // Accessors 39 // Accessors
37 const std::string& security() const { return security_; } 40 const std::string& security() const { return security_; }
38 const std::string& ip_address() const { return ip_address_; } 41 const std::string& ip_address() const { return ip_address_; }
42 const std::vector<std::string>& dns_servers() const { return dns_servers_; }
39 const std::string& device_path() const { return device_path_; } 43 const std::string& device_path() const { return device_path_; }
40 const std::string& guid() const { return guid_; } 44 const std::string& guid() const { return guid_; }
41 const std::string& connection_state() const { return connection_state_; } 45 const std::string& connection_state() const { return connection_state_; }
42 const std::string& error() const { return error_; } 46 const std::string& error() const { return error_; }
43 bool auto_connect() const { return auto_connect_; } 47 bool auto_connect() const { return auto_connect_; }
44 bool favorite() const { return favorite_; } 48 bool favorite() const { return favorite_; }
45 int priority() const { return priority_; } 49 int priority() const { return priority_; }
46 // Wireless property accessors 50 // Wireless property accessors
47 int signal_strength() const { return signal_strength_; } 51 int signal_strength() const { return signal_strength_; }
48 // Cellular property accessors 52 // Cellular property accessors
49 const std::string& technology() const { return technology_; } 53 const std::string& technology() const { return technology_; }
50 const std::string& activation_state() const { return activation_state_; } 54 const std::string& activation_state() const { return activation_state_; }
51 const std::string& roaming() const { return roaming_; } 55 const std::string& roaming() const { return roaming_; }
52 bool activate_over_non_cellular_networks() const { 56 bool activate_over_non_cellular_networks() const {
53 return activate_over_non_cellular_networks_; 57 return activate_over_non_cellular_networks_;
54 } 58 }
55 bool cellular_out_of_credits() const { return cellular_out_of_credits_; } 59 bool cellular_out_of_credits() const { return cellular_out_of_credits_; }
56 60
57 bool IsConnectedState() const; 61 bool IsConnectedState() const;
58 bool IsConnectingState() const; 62 bool IsConnectingState() const;
59 63
60 // Helpers (used e.g. when a state is cached) 64 // Helpers (used e.g. when a state is cached)
61 static bool StateIsConnected(const std::string& connection_state); 65 static bool StateIsConnected(const std::string& connection_state);
62 static bool StateIsConnecting(const std::string& connection_state); 66 static bool StateIsConnecting(const std::string& connection_state);
63 67
68 // Helper to return a full prefixed version of an IPConfig property
69 // key.
70 static std::string IPConfigProperty(const char* key);
71
64 private: 72 private:
65 friend class NetworkStateHandler; 73 friend class NetworkStateHandler;
66 friend class NetworkChangeNotifierChromeosUpdateTest; 74 friend class NetworkChangeNotifierChromeosUpdateTest;
67 75
68 // Called by NetworkStateHandler when the ip config changes. 76 // Called by NetworkStateHandler when the ip config changes.
69 void set_ip_address(const std::string& ip_address) { 77 void set_ip_address(const std::string& ip_address) {
70 ip_address_ = ip_address; 78 ip_address_ = ip_address;
71 } 79 }
80 void set_dns_servers(const std::vector<std::string>& dns_servers) {
81 dns_servers_ = dns_servers;
82 }
72 83
73 // Common Network Service properties 84 // Common Network Service properties
74 std::string security_; 85 std::string security_;
75 std::string device_path_; 86 std::string device_path_;
76 std::string guid_; 87 std::string guid_;
77 std::string ip_address_;
78 std::string connection_state_; 88 std::string connection_state_;
79 std::string error_; 89 std::string error_;
80 bool auto_connect_; 90 bool auto_connect_;
81 bool favorite_; 91 bool favorite_;
82 int priority_; 92 int priority_;
93 // IPConfig properties.
94 // Note: These do not correspond to actual Shill.Service properties
95 // but are derived from the service's corresponding IPConfig object.
96 std::string ip_address_;
97 std::vector<std::string> dns_servers_;
83 // Wireless properties 98 // Wireless properties
84 int signal_strength_; 99 int signal_strength_;
85 // Cellular properties 100 // Cellular properties
86 std::string technology_; 101 std::string technology_;
87 std::string activation_state_; 102 std::string activation_state_;
88 std::string roaming_; 103 std::string roaming_;
89 bool activate_over_non_cellular_networks_; 104 bool activate_over_non_cellular_networks_;
90 bool cellular_out_of_credits_; 105 bool cellular_out_of_credits_;
91 106
92 DISALLOW_COPY_AND_ASSIGN(NetworkState); 107 DISALLOW_COPY_AND_ASSIGN(NetworkState);
93 }; 108 };
94 109
95 } // namespace chromeos 110 } // namespace chromeos
96 111
97 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ 112 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW
« no previous file with comments | « chromeos/network/network_change_notifier_chromeos_unittest.cc ('k') | chromeos/network/network_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698