| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromeos/network/network_ui_data.h" | 5 #include "chromeos/network/network_ui_data.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 | 12 |
| 12 namespace chromeos { | 13 namespace chromeos { |
| 13 | 14 |
| 14 // Top-level UI data dictionary keys. | 15 // Top-level UI data dictionary keys. |
| 15 const char NetworkUIData::kKeyONCSource[] = "onc_source"; | 16 const char NetworkUIData::kKeyONCSource[] = "onc_source"; |
| 16 const char NetworkUIData::kKeyUserSettings[] = "user_settings"; | 17 const char NetworkUIData::kKeyUserSettings[] = "user_settings"; |
| 17 const char NetworkUIData::kONCSourceUserImport[] = "user_import"; | 18 const char NetworkUIData::kONCSourceUserImport[] = "user_import"; |
| 18 const char NetworkUIData::kONCSourceDevicePolicy[] = "device_policy"; | 19 const char NetworkUIData::kONCSourceDevicePolicy[] = "device_policy"; |
| 19 const char NetworkUIData::kONCSourceUserPolicy[] = "user_policy"; | 20 const char NetworkUIData::kONCSourceUserPolicy[] = "user_policy"; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 100 } |
| 100 | 101 |
| 101 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { | 102 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { |
| 102 dict->Clear(); | 103 dict->Clear(); |
| 103 | 104 |
| 104 std::string source_string = GetONCSourceAsString(); | 105 std::string source_string = GetONCSourceAsString(); |
| 105 if (!source_string.empty()) | 106 if (!source_string.empty()) |
| 106 dict->SetString(kKeyONCSource, source_string); | 107 dict->SetString(kKeyONCSource, source_string); |
| 107 | 108 |
| 108 if (user_settings_) | 109 if (user_settings_) |
| 109 dict->SetWithoutPathExpansion(kKeyUserSettings, | 110 dict->SetWithoutPathExpansion( |
| 110 user_settings_->DeepCopy()); | 111 kKeyUserSettings, base::MakeUnique<base::Value>(*user_settings_)); |
| 111 } | 112 } |
| 112 | 113 |
| 113 // static | 114 // static |
| 114 std::unique_ptr<NetworkUIData> NetworkUIData::CreateFromONC( | 115 std::unique_ptr<NetworkUIData> NetworkUIData::CreateFromONC( |
| 115 ::onc::ONCSource onc_source) { | 116 ::onc::ONCSource onc_source) { |
| 116 std::unique_ptr<NetworkUIData> ui_data(new NetworkUIData()); | 117 std::unique_ptr<NetworkUIData> ui_data(new NetworkUIData()); |
| 117 | 118 |
| 118 ui_data->onc_source_ = onc_source; | 119 ui_data->onc_source_ = onc_source; |
| 119 | 120 |
| 120 return ui_data; | 121 return ui_data; |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace chromeos | 124 } // namespace chromeos |
| OLD | NEW |