OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/cros/network_ui_data.h" | 5 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/chromeos/cros/network_library.h" | 8 #include "chrome/browser/chromeos/cros/network_library.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 NetworkUIData::~NetworkUIData() { | 62 NetworkUIData::~NetworkUIData() { |
63 } | 63 } |
64 | 64 |
65 void NetworkUIData::SetProperty(const char* property_key, | 65 void NetworkUIData::SetProperty(const char* property_key, |
66 const NetworkPropertyUIData& ui_data) { | 66 const NetworkPropertyUIData& ui_data) { |
67 properties_.Set(property_key, ui_data.BuildDictionary()); | 67 properties_.Set(property_key, ui_data.BuildDictionary()); |
68 } | 68 } |
69 | 69 |
70 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { | 70 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { |
| 71 dict->Clear(); |
| 72 |
71 std::string source_string(GetONCSourceMapper().GetKey(onc_source_)); | 73 std::string source_string(GetONCSourceMapper().GetKey(onc_source_)); |
72 if (!source_string.empty()) | 74 if (!source_string.empty()) |
73 dict->SetString(kKeyONCSource, source_string); | 75 dict->SetString(kKeyONCSource, source_string); |
74 dict->Set(kKeyProperties, properties_.DeepCopy()); | 76 dict->Set(kKeyProperties, properties_.DeepCopy()); |
75 } | 77 } |
76 | 78 |
77 // static | 79 // static |
78 NetworkUIData::ONCSource NetworkUIData::GetONCSource(const Network* network) { | 80 NetworkUIData::ONCSource NetworkUIData::GetONCSource(const Network* network) { |
79 std::string source; | 81 std::string source; |
80 if (network->ui_data()->GetString(kKeyONCSource, &source)) | 82 if (network->ui_data()->GetString(kKeyONCSource, &source)) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // static | 161 // static |
160 EnumMapper<NetworkPropertyUIData::Controller>& | 162 EnumMapper<NetworkPropertyUIData::Controller>& |
161 NetworkPropertyUIData::GetControllerMapper() { | 163 NetworkPropertyUIData::GetControllerMapper() { |
162 CR_DEFINE_STATIC_LOCAL(EnumMapper<Controller>, mapper, | 164 CR_DEFINE_STATIC_LOCAL(EnumMapper<Controller>, mapper, |
163 (kControllerTable, arraysize(kControllerTable), | 165 (kControllerTable, arraysize(kControllerTable), |
164 CONTROLLER_USER)); | 166 CONTROLLER_USER)); |
165 return mapper; | 167 return mapper; |
166 } | 168 } |
167 | 169 |
168 } // namespace chromeos | 170 } // namespace chromeos |
OLD | NEW |