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 CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/onc/onc_constants.h"
15 class DictionaryValue
;
21 // Holds meta information for a network property: Whether the property is under
22 // policy control, if it is user-editable, and policy-provided default value, if
24 class NetworkPropertyUIData
{
26 // Initializes with ONC_SOURCE_NONE and no default value.
27 NetworkPropertyUIData();
29 // Initializes with the given |onc_source| and no default value.
30 explicit NetworkPropertyUIData(::onc::ONCSource onc_source
);
32 ~NetworkPropertyUIData();
34 // Update the property object from dictionary, reading the key given by
36 void ParseOncProperty(::onc::ONCSource onc_source
,
37 const base::DictionaryValue
* onc
,
38 const std::string
& property_key
);
40 const base::Value
* default_value() const { return default_value_
.get(); }
41 bool IsManaged() const {
42 return (onc_source_
== ::onc::ONC_SOURCE_DEVICE_POLICY
||
43 onc_source_
== ::onc::ONC_SOURCE_USER_POLICY
);
45 bool IsEditable() const { return !IsManaged(); }
48 ::onc::ONCSource onc_source_
;
49 scoped_ptr
<base::Value
> default_value_
;
51 DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData
);
54 } // namespace chromeos
56 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_PROPERTY_UI_DATA_H_