| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAVORITE_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_FAVORITE_STATE_H_ |
| 6 #define CHROMEOS_NETWORK_FAVORITE_STATE_H_ | 6 #define CHROMEOS_NETWORK_FAVORITE_STATE_H_ |
| 7 | 7 |
| 8 #include "chromeos/network/managed_state.h" | 8 #include "chromeos/network/managed_state.h" |
| 9 #include "chromeos/network/network_ui_data.h" |
| 9 #include "chromeos/network/onc/onc_constants.h" | 10 #include "chromeos/network/onc/onc_constants.h" |
| 10 | 11 |
| 11 namespace chromeos { | 12 namespace chromeos { |
| 12 | 13 |
| 13 // A simple class to provide essential information for Services created | 14 // A simple class to provide essential information for Services created |
| 14 // by Shill corresponding to Profile Entries (i.e. 'preferred' or 'favorite' | 15 // by Shill corresponding to Profile Entries (i.e. 'preferred' or 'favorite' |
| 15 // networks). | 16 // networks). |
| 16 // Note: NetworkStateHandler will store an entry for each member of | 17 // Note: NetworkStateHandler will store an entry for each member of |
| 17 // Manager.ServiceCompleteList, even for visible entries that are not | 18 // Manager.ServiceCompleteList, even for visible entries that are not |
| 18 // favorites. This is necessary to avoid unnecessarily re-requesting entries, | 19 // favorites. This is necessary to avoid unnecessarily re-requesting entries, |
| 19 // and to limit the code complexity. The is_favorite() accessor is used to skip | 20 // and to limit the code complexity. The is_favorite() accessor is used to skip |
| 20 // entries that are not actually favorites. | 21 // entries that are not actually favorites. |
| 21 class CHROMEOS_EXPORT FavoriteState : public ManagedState { | 22 class CHROMEOS_EXPORT FavoriteState : public ManagedState { |
| 22 public: | 23 public: |
| 23 explicit FavoriteState(const std::string& path); | 24 explicit FavoriteState(const std::string& path); |
| 24 virtual ~FavoriteState(); | 25 virtual ~FavoriteState(); |
| 25 | 26 |
| 26 // ManagedState overrides | 27 // ManagedState overrides |
| 27 virtual bool PropertyChanged(const std::string& key, | 28 virtual bool PropertyChanged(const std::string& key, |
| 28 const base::Value& value) OVERRIDE; | 29 const base::Value& value) OVERRIDE; |
| 29 | 30 |
| 30 // Accessors | 31 // Accessors |
| 31 const std::string& profile_path() const { return profile_path_; } | 32 const std::string& profile_path() const { return profile_path_; } |
| 32 bool is_favorite() const { return !profile_path_.empty(); } | 33 bool is_favorite() const { return !profile_path_.empty(); } |
| 33 onc::ONCSource onc_source() const { return onc_source_; } | 34 const NetworkUIData& ui_data() const { return ui_data_; } |
| 34 | 35 |
| 35 // Returns true if the ONC source is a device or user policy. | 36 // Returns true if the ONC source is a device or user policy. |
| 36 bool IsManaged() const; | 37 bool IsManaged() const; |
| 37 | 38 |
| 38 // Returns true if the network properties are stored in a user profile. | 39 // Returns true if the network properties are stored in a user profile. |
| 39 bool IsPrivate() const; | 40 bool IsPrivate() const; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 std::string profile_path_; | 43 std::string profile_path_; |
| 43 onc::ONCSource onc_source_; | 44 NetworkUIData ui_data_; |
| 44 | 45 |
| 45 DISALLOW_COPY_AND_ASSIGN(FavoriteState); | 46 DISALLOW_COPY_AND_ASSIGN(FavoriteState); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace chromeos | 49 } // namespace chromeos |
| 49 | 50 |
| 50 #endif // CHROMEOS_NETWORK_FAVORITE_STATE_H_ | 51 #endif // CHROMEOS_NETWORK_FAVORITE_STATE_H_ |
| OLD | NEW |