blob: 10db2d794d72b6b55ccc2a231b6d7e0bc13d1be9 (
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
|
// 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 CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_
#define CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
class Value;
}
namespace chromeos {
// Holds meta information for a network property: Whether the property is under
// policy control, if it is user-editable, and policy-provided default value, if
// available.
class NetworkPropertyUIData {
public:
// Initializes with ONC_SOURCE_NONE and no default value.
NetworkPropertyUIData();
// Initializes with the given |onc_source| and no default value.
explicit NetworkPropertyUIData(::onc::ONCSource onc_source);
~NetworkPropertyUIData();
// Update the property object from dictionary, reading the key given by
// |property_key|.
void ParseOncProperty(::onc::ONCSource onc_source,
const base::DictionaryValue* onc,
const std::string& property_key);
const base::Value* default_value() const { return default_value_.get(); }
bool IsManaged() const {
return (onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY ||
onc_source_ == ::onc::ONC_SOURCE_USER_POLICY);
}
bool IsEditable() const { return !IsManaged(); }
private:
::onc::ONCSource onc_source_;
scoped_ptr<base::Value> default_value_;
DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_
|