Implemented consumer management unenrollment.
[chromium-blink-merge.git] / chrome / browser / chromeos / options / network_property_ui_data.h
blob10db2d794d72b6b55ccc2a231b6d7e0bc13d1be9
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_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/onc/onc_constants.h"
14 namespace base {
15 class DictionaryValue;
16 class Value;
19 namespace chromeos {
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
23 // available.
24 class NetworkPropertyUIData {
25 public:
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
35 // |property_key|.
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(); }
47 private:
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_