Partially fix compilation of media_unittests with Xcode 7 (OS X 10.11 SDK).
[chromium-blink-merge.git] / chromeos / network / network_ui_data.h
blob66cb2361cb6d14c7cbee5a33ee9fbc5ce747a20e
1 // Copyright (c) 2012 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_NETWORK_UI_DATA_H_
6 #define CHROMEOS_NETWORK_NETWORK_UI_DATA_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chromeos/chromeos_export.h"
13 #include "components/onc/onc_constants.h"
15 namespace base {
16 class DictionaryValue;
19 namespace chromeos {
21 // Helper for accessing and setting values in the network's UI data dictionary.
22 // Accessing values is done via static members that take the network as an
23 // argument. In order to fill a UI data dictionary, construct an instance, set
24 // up your data members, and call FillDictionary(). For example, if you have a
25 // |network|:
27 // NetworkUIData ui_data;
28 // ui_data.FillDictionary(network->ui_data());
29 class CHROMEOS_EXPORT NetworkUIData {
30 public:
31 NetworkUIData();
32 NetworkUIData(const NetworkUIData& other);
33 NetworkUIData& operator=(const NetworkUIData& other);
34 explicit NetworkUIData(const base::DictionaryValue& dict);
35 ~NetworkUIData();
37 ::onc::ONCSource onc_source() const { return onc_source_; }
39 const base::DictionaryValue* user_settings() const {
40 return user_settings_.get();
42 void set_user_settings(scoped_ptr<base::DictionaryValue> dict);
44 // Returns |onc_source_| as a string, one of kONCSource*.
45 std::string GetONCSourceAsString() const;
47 // Fills in |dict| with the currently configured values. This will write the
48 // keys appropriate for Network::ui_data() as defined below (kKeyXXX).
49 void FillDictionary(base::DictionaryValue* dict) const;
51 // Creates a NetworkUIData object from |onc_source|. This function is used to
52 // create the "UIData" property of the Shill configuration.
53 static scoped_ptr<NetworkUIData> CreateFromONC(::onc::ONCSource onc_source);
55 // Key for storing source of the ONC network.
56 static const char kKeyONCSource[];
58 // Key for storing the user settings.
59 static const char kKeyUserSettings[];
61 // Values for kKeyONCSource
62 static const char kONCSourceUserImport[];
63 static const char kONCSourceDevicePolicy[];
64 static const char kONCSourceUserPolicy[];
66 private:
67 ::onc::ONCSource onc_source_;
68 scoped_ptr<base::DictionaryValue> user_settings_;
71 } // namespace chromeos
73 #endif // CHROMEOS_NETWORK_NETWORK_UI_DATA_H_