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 #include "chromeos/network/managed_state.h" | 5 #include "chromeos/network/managed_state.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/network/device_state.h" | 9 #include "chromeos/network/device_state.h" |
10 #include "chromeos/network/network_state.h" | 10 #include "chromeos/network/network_state.h" |
11 #include "third_party/cros_system_api/dbus/service_constants.h" | 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 ManagedState::ManagedState(ManagedType type, const std::string& path) | 15 ManagedState::ManagedState(ManagedType type, const std::string& path) |
16 : managed_type_(type), | 16 : managed_type_(type), |
17 path_(path), | 17 path_(path), |
18 is_observed_(false) { | 18 is_observed_(false), |
| 19 update_requested_(false) { |
19 } | 20 } |
20 | 21 |
21 ManagedState::~ManagedState() { | 22 ManagedState::~ManagedState() { |
22 } | 23 } |
23 | 24 |
24 ManagedState* ManagedState::Create(ManagedType type, const std::string& path) { | 25 ManagedState* ManagedState::Create(ManagedType type, const std::string& path) { |
25 switch(type) { | 26 switch (type) { |
26 case MANAGED_TYPE_NETWORK: | 27 case MANAGED_TYPE_NETWORK: |
27 return new NetworkState(path); | 28 return new NetworkState(path); |
28 case MANAGED_TYPE_DEVICE: | 29 case MANAGED_TYPE_DEVICE: |
29 return new DeviceState(path); | 30 return new DeviceState(path); |
30 } | 31 } |
31 return NULL; | 32 return NULL; |
32 } | 33 } |
33 | 34 |
34 NetworkState* ManagedState::AsNetworkState() { | 35 NetworkState* ManagedState::AsNetworkState() { |
35 if (managed_type() == MANAGED_TYPE_NETWORK) | 36 if (managed_type() == MANAGED_TYPE_NETWORK) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 LOG(WARNING) << "Failed to parse string value for:" << key; | 93 LOG(WARNING) << "Failed to parse string value for:" << key; |
93 return false; | 94 return false; |
94 } | 95 } |
95 if (*out_value == new_value) | 96 if (*out_value == new_value) |
96 return false; | 97 return false; |
97 *out_value = new_value; | 98 *out_value = new_value; |
98 return true; | 99 return true; |
99 } | 100 } |
100 | 101 |
101 } // namespace chromeos | 102 } // namespace chromeos |
OLD | NEW |