blob: e1d8e110a864286238f13ca16040e32d2df8ac22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_NETWORK_FAVORITE_STATE_H_
#define CHROMEOS_NETWORK_FAVORITE_STATE_H_
#include <string>
#include "base/values.h"
#include "chromeos/network/managed_state.h"
#include "chromeos/network/network_ui_data.h"
#include "components/onc/onc_constants.h"
namespace chromeos {
// A simple class to provide essential information for Services created
// by Shill corresponding to Profile Entries (i.e. 'preferred' or 'favorite'
// networks).
// Note: NetworkStateHandler will store an entry for each member of
// Manager.ServiceCompleteList, even for visible entries that are not
// favorites. This is necessary to avoid unnecessarily re-requesting entries,
// and to limit the code complexity. The is_favorite() accessor is used to skip
// entries that are not actually favorites.
class CHROMEOS_EXPORT FavoriteState : public ManagedState {
public:
explicit FavoriteState(const std::string& path);
virtual ~FavoriteState();
// ManagedState overrides
virtual bool PropertyChanged(const std::string& key,
const base::Value& value) OVERRIDE;
// Accessors
const std::string& profile_path() const { return profile_path_; }
bool is_favorite() const { return !profile_path_.empty(); }
const NetworkUIData& ui_data() const { return ui_data_; }
const base::DictionaryValue& proxy_config() const { return proxy_config_; }
const std::string& guid() const { return guid_; }
// Returns true if the network properties are stored in a user profile.
bool IsPrivate() const;
// Fills |dictionary| with the state properties. Only properties that are
// parsed by PropertyChanged are stored in |dictionary|. The dictionary
// includes the 'onc_source' property from |ui_data_|.
void GetProperties(base::DictionaryValue* dictionary) const;
private:
std::string profile_path_;
NetworkUIData ui_data_;
std::string guid_;
// TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
// provides proxy configuration. crbug.com/241775
base::DictionaryValue proxy_config_;
DISALLOW_COPY_AND_ASSIGN(FavoriteState);
};
} // namespace chromeos
#endif // CHROMEOS_NETWORK_FAVORITE_STATE_H_
|