OLD | NEW |
---|---|
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_MANAGED_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_MANAGED_STATE_H_ |
6 #define CHROMEOS_NETWORK_MANAGED_STATE_H_ | 6 #define CHROMEOS_NETWORK_MANAGED_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class Value; | 15 class Value; |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 } | 17 } |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 class DeviceState; | 21 class DeviceState; |
22 class FavoriteState; | 22 class FavoriteState; |
23 class NetworkState; | 23 class NetworkState; |
24 | 24 |
25 // Base class for states managed by NetworkStateManger which are associated | 25 // Base class for states managed by NetworkStateManger which are associated |
26 // with a Shill path (e.g. service path or device path). | 26 // with a Shill path (e.g. service path or device path). |
27 class ManagedState { | 27 class CHROMEOS_EXPORT ManagedState { |
28 public: | 28 public: |
29 enum ManagedType { | 29 enum ManagedType { |
30 MANAGED_TYPE_NETWORK, | 30 MANAGED_TYPE_NETWORK, |
31 MANAGED_TYPE_FAVORITE, | 31 MANAGED_TYPE_FAVORITE, |
32 MANAGED_TYPE_DEVICE | 32 MANAGED_TYPE_DEVICE |
33 }; | 33 }; |
34 | 34 |
35 virtual ~ManagedState(); | 35 virtual ~ManagedState(); |
36 | 36 |
37 // This will construct and return a new instance of the appropriate class | 37 // This will construct and return a new instance of the appropriate class |
(...skipping 29 matching lines...) Expand all Loading... | |
67 const std::string& path() const { return path_; } | 67 const std::string& path() const { return path_; } |
68 const std::string& name() const { return name_; } | 68 const std::string& name() const { return name_; } |
69 const std::string& type() const { return type_; } | 69 const std::string& type() const { return type_; } |
70 bool update_received() const { return update_received_; } | 70 bool update_received() const { return update_received_; } |
71 void set_update_received() { update_received_ = true; } | 71 void set_update_received() { update_received_ = true; } |
72 bool update_requested() const { return update_requested_; } | 72 bool update_requested() const { return update_requested_; } |
73 void set_update_requested(bool update_requested) { | 73 void set_update_requested(bool update_requested) { |
74 update_requested_ = update_requested; | 74 update_requested_ = update_requested; |
75 } | 75 } |
76 | 76 |
77 // Returns true if the network's |type()| is ethernet (with or without EAP). | |
78 bool IsTypeEthernet() const; | |
stevenjb
2013/08/28 15:51:30
This should really be IsTypeWired() and we should
pneubeck (no reviews)
2013/09/02 20:41:21
Done.
| |
79 | |
77 protected: | 80 protected: |
78 ManagedState(ManagedType type, const std::string& path); | 81 ManagedState(ManagedType type, const std::string& path); |
79 | 82 |
80 // Parses common property keys (name, type). | 83 // Parses common property keys (name, type). |
81 bool ManagedStatePropertyChanged(const std::string& key, | 84 bool ManagedStatePropertyChanged(const std::string& key, |
82 const base::Value& value); | 85 const base::Value& value); |
83 | 86 |
84 // Helper methods that log warnings and return true if parsing succeeded and | 87 // Helper methods that log warnings and return true if parsing succeeded and |
85 // the new value does not match the existing output value. | 88 // the new value does not match the existing output value. |
86 bool GetBooleanValue(const std::string& key, | 89 bool GetBooleanValue(const std::string& key, |
(...skipping 28 matching lines...) Expand all Loading... | |
115 | 118 |
116 // Tracks when an update has been requested. | 119 // Tracks when an update has been requested. |
117 bool update_requested_; | 120 bool update_requested_; |
118 | 121 |
119 DISALLOW_COPY_AND_ASSIGN(ManagedState); | 122 DISALLOW_COPY_AND_ASSIGN(ManagedState); |
120 }; | 123 }; |
121 | 124 |
122 } // namespace chromeos | 125 } // namespace chromeos |
123 | 126 |
124 #endif // CHROMEOS_NETWORK_MANAGED_STATE_H_ | 127 #endif // CHROMEOS_NETWORK_MANAGED_STATE_H_ |
OLD | NEW |