Chromium Code Reviews| 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" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 // This will construct and return a new instance of the appropriate class | 34 // This will construct and return a new instance of the appropriate class |
| 35 // based on |type|. | 35 // based on |type|. |
| 36 static ManagedState* Create(ManagedType type, const std::string& path); | 36 static ManagedState* Create(ManagedType type, const std::string& path); |
| 37 | 37 |
| 38 // Returns the specific class pointer if this is the correct type, or | 38 // Returns the specific class pointer if this is the correct type, or |
| 39 // NULL if it is not. | 39 // NULL if it is not. |
| 40 NetworkState* AsNetworkState(); | 40 NetworkState* AsNetworkState(); |
| 41 DeviceState* AsDeviceState(); | 41 DeviceState* AsDeviceState(); |
| 42 | 42 |
| 43 // Called by NetworkStateHandler when a property changes. Returns false if | 43 // Called by NetworkStateHandler when a property was received. The return |
|
stevenjb
2013/05/15 17:44:14
I think that the original 'Returns false if' claus
pneubeck (no reviews)
2013/05/15 20:24:48
Please double check my change to the return statem
| |
| 44 // the property was not recognized, was not parsed successfully, or is | 44 // value only guarantees: If false then the state wasn't modified (e.g. if the |
| 45 // unchanged (complex properties may be assumed to have changed). | 45 // property wasn't parsed successfully). |
| 46 // I.e. if it returns true, the state might be modified or not. | |
| 47 // For reducing the number of notifications, false positives should be | |
| 48 // avoided. | |
| 46 virtual bool PropertyChanged(const std::string& key, | 49 virtual bool PropertyChanged(const std::string& key, |
| 47 const base::Value& value) = 0; | 50 const base::Value& value) = 0; |
| 48 | 51 |
| 49 // Called by NetworkStateHandler after all calls to PropertyChanged for the | 52 // Called by NetworkStateHandler after all calls to PropertyChanged for the |
| 50 // initial set of properties. Used to update state requiring multiple | 53 // initial set of properties. Used to update state requiring multiple |
| 51 // parsed properties, e.g. name from hex_ssid in NetworkState. | 54 // parsed properties, e.g. name from hex_ssid in NetworkState. |
| 52 virtual void InitialPropertiesReceived(); | 55 virtual void InitialPropertiesReceived(); |
| 53 | 56 |
| 54 const ManagedType managed_type() const { return managed_type_; } | 57 const ManagedType managed_type() const { return managed_type_; } |
| 55 const std::string& path() const { return path_; } | 58 const std::string& path() const { return path_; } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 | 96 |
| 94 // Tracks when the state is being observed. | 97 // Tracks when the state is being observed. |
| 95 bool is_observed_; | 98 bool is_observed_; |
| 96 | 99 |
| 97 DISALLOW_COPY_AND_ASSIGN(ManagedState); | 100 DISALLOW_COPY_AND_ASSIGN(ManagedState); |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 } // namespace chromeos | 103 } // namespace chromeos |
| 101 | 104 |
| 102 #endif // CHROMEOS_NETWORK_MANAGED_STATE_H_ | 105 #endif // CHROMEOS_NETWORK_MANAGED_STATE_H_ |
| OLD | NEW |