| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_NETWORK_FAVORITE_STATE_H_ | |
| 6 #define CHROMEOS_NETWORK_FAVORITE_STATE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/values.h" | |
| 11 #include "chromeos/network/managed_state.h" | |
| 12 #include "chromeos/network/network_ui_data.h" | |
| 13 #include "components/onc/onc_constants.h" | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 // A simple class to provide essential information for Services created | |
| 18 // by Shill corresponding to Profile Entries (i.e. 'preferred' or 'favorite' | |
| 19 // networks). | |
| 20 // Note: NetworkStateHandler will store an entry for each member of | |
| 21 // Manager.ServiceCompleteList, even for visible entries that are not | |
| 22 // saved. This is necessary to avoid unnecessarily re-requesting entries, | |
| 23 // and to limit the code complexity. It is also convenient for tracking the | |
| 24 // complete list of "known" networks. The IsInProfile() accessor is used to | |
| 25 // skip entries that are not actually saved in a profile. | |
| 26 class CHROMEOS_EXPORT FavoriteState : public ManagedState { | |
| 27 public: | |
| 28 explicit FavoriteState(const std::string& path); | |
| 29 virtual ~FavoriteState(); | |
| 30 | |
| 31 // ManagedState overrides | |
| 32 virtual bool PropertyChanged(const std::string& key, | |
| 33 const base::Value& value) OVERRIDE; | |
| 34 virtual void GetStateProperties( | |
| 35 base::DictionaryValue* dictionary) const OVERRIDE; | |
| 36 | |
| 37 // Accessors | |
| 38 const std::string& profile_path() const { return profile_path_; } | |
| 39 const NetworkUIData& ui_data() const { return ui_data_; } | |
| 40 const base::DictionaryValue& proxy_config() const { return proxy_config_; } | |
| 41 const std::string& guid() const { return guid_; } | |
| 42 | |
| 43 // Returns true if this is a favorite stored in a profile (see note above). | |
| 44 bool IsInProfile() const; | |
| 45 | |
| 46 // Returns true if the network properties are stored in a user profile. | |
| 47 bool IsPrivate() const; | |
| 48 | |
| 49 // Returns a specifier for identifying this network in the absence of a GUID. | |
| 50 // This should only be used by NetworkStateHandler for keeping track of | |
| 51 // GUIDs assigned to unsaved networks. | |
| 52 std::string GetSpecifier() const; | |
| 53 | |
| 54 // Set the GUID. Called exclusively by NetworkStateHandler. | |
| 55 void SetGuid(const std::string& guid); | |
| 56 | |
| 57 private: | |
| 58 std::string profile_path_; | |
| 59 NetworkUIData ui_data_; | |
| 60 std::string guid_; | |
| 61 | |
| 62 // Keep track of Service.Security. Only used for specifying wifi networks. | |
| 63 std::string security_; | |
| 64 | |
| 65 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler | |
| 66 // provides proxy configuration. crbug.com/241775 | |
| 67 base::DictionaryValue proxy_config_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(FavoriteState); | |
| 70 }; | |
| 71 | |
| 72 } // namespace chromeos | |
| 73 | |
| 74 #endif // CHROMEOS_NETWORK_FAVORITE_STATE_H_ | |
| OLD | NEW |