Less strict CHECK for DeviceCapabilities results.
[chromium-blink-merge.git] / chromeos / network / favorite_state.h
blobdbce3c03a8d85573342f30e5fcf49caa8fce8aa7
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.
5 #ifndef CHROMEOS_NETWORK_FAVORITE_STATE_H_
6 #define CHROMEOS_NETWORK_FAVORITE_STATE_H_
8 #include <string>
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"
15 namespace chromeos {
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 // favorites. This is necessary to avoid unnecessarily re-requesting entries,
23 // and to limit the code complexity. The is_favorite() accessor is used to skip
24 // entries that are not actually favorites.
25 class CHROMEOS_EXPORT FavoriteState : public ManagedState {
26 public:
27 explicit FavoriteState(const std::string& path);
28 virtual ~FavoriteState();
30 // ManagedState overrides
31 virtual bool PropertyChanged(const std::string& key,
32 const base::Value& value) OVERRIDE;
34 // Accessors
35 const std::string& profile_path() const { return profile_path_; }
36 bool is_favorite() const { return !profile_path_.empty(); }
37 const NetworkUIData& ui_data() const { return ui_data_; }
38 const base::DictionaryValue& proxy_config() const { return proxy_config_; }
39 const std::string& guid() const { return guid_; }
41 // Returns true if the network properties are stored in a user profile.
42 bool IsPrivate() const;
44 private:
45 std::string profile_path_;
46 NetworkUIData ui_data_;
47 std::string guid_;
49 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
50 // provides proxy configuration. crbug.com/241775
51 base::DictionaryValue proxy_config_;
53 DISALLOW_COPY_AND_ASSIGN(FavoriteState);
56 } // namespace chromeos
58 #endif // CHROMEOS_NETWORK_FAVORITE_STATE_H_