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/onc/onc_translator.h" | 5 #include "chromeos/network/onc/onc_translator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chromeos/network/network_state.h" | 14 #include "chromeos/network/network_state.h" |
15 #include "chromeos/network/network_state_handler.h" | |
15 #include "chromeos/network/onc/onc_signature.h" | 16 #include "chromeos/network/onc/onc_signature.h" |
16 #include "chromeos/network/onc/onc_translation_tables.h" | 17 #include "chromeos/network/onc/onc_translation_tables.h" |
17 #include "chromeos/network/shill_property_util.h" | 18 #include "chromeos/network/shill_property_util.h" |
18 #include "components/onc/onc_constants.h" | 19 #include "components/onc/onc_constants.h" |
19 #include "third_party/cros_system_api/dbus/service_constants.h" | 20 #include "third_party/cros_system_api/dbus/service_constants.h" |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 namespace onc { | 23 namespace onc { |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 | 452 |
452 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( | 453 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( |
453 const base::DictionaryValue& shill_dictionary, | 454 const base::DictionaryValue& shill_dictionary, |
454 const OncValueSignature* onc_signature) { | 455 const OncValueSignature* onc_signature) { |
455 CHECK(onc_signature != NULL); | 456 CHECK(onc_signature != NULL); |
456 | 457 |
457 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 458 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
458 return translator.CreateTranslatedONCObject(); | 459 return translator.CreateTranslatedONCObject(); |
459 } | 460 } |
460 | 461 |
462 scoped_ptr<base::ListValue> TranslateShillNetworkListToONC( | |
pneubeck (no reviews)
2014/05/08 13:25:12
see my comment in the other CL. Please move out of
stevenjb
2014/05/08 22:32:26
Done, but note: there is a dependency on NetworkSt
pneubeck (no reviews)
2014/05/12 13:37:07
Yes, that one is only comparing to Shill constants
| |
463 NetworkTypePattern pattern) { | |
464 NetworkStateHandler::NetworkStateList network_states; | |
465 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( | |
466 pattern, &network_states); | |
467 | |
468 scoped_ptr<base::ListValue> network_properties_list(new base::ListValue); | |
469 for (NetworkStateHandler::NetworkStateList::iterator it = | |
470 network_states.begin(); | |
471 it != network_states.end(); | |
472 ++it) { | |
473 base::DictionaryValue shill_dictionary; | |
474 (*it)->GetStateProperties(&shill_dictionary); | |
475 | |
476 scoped_ptr<base::DictionaryValue> onc_network_part = | |
477 TranslateShillServiceToONCPart( | |
478 shill_dictionary, &chromeos::onc::kNetworkWithStateSignature); | |
479 network_properties_list->Append(onc_network_part.release()); | |
480 } | |
481 return network_properties_list.Pass(); | |
482 } | |
483 | |
461 } // namespace onc | 484 } // namespace onc |
462 } // namespace chromeos | 485 } // namespace chromeos |
OLD | NEW |