OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // Prints value with specified indentation level | 33 // Prints value with specified indentation level |
34 void PrintValue(const base::Value* value, int indentLevel) { | 34 void PrintValue(const base::Value* value, int indentLevel) { |
35 std::string indent(indentLevel * 2, ' '); | 35 std::string indent(indentLevel * 2, ' '); |
36 const base::ListValue* list_value = nullptr; | 36 const base::ListValue* list_value = nullptr; |
37 const base::DictionaryValue* dict_value = nullptr; | 37 const base::DictionaryValue* dict_value = nullptr; |
38 std::string string_value; | 38 std::string string_value; |
39 bool bool_value = false; | 39 bool bool_value = false; |
40 if (value->GetAsList(&list_value)) { | 40 if (value->GetAsList(&list_value)) { |
41 for (const auto& v : *list_value) { | 41 for (const auto& v : *list_value) { |
42 PrintValue(v.get(), indentLevel); | 42 PrintValue(&v, indentLevel); |
43 } | 43 } |
44 } else if (value->GetAsString(&string_value)) { | 44 } else if (value->GetAsString(&string_value)) { |
45 OutputString(indent); | 45 OutputString(indent); |
46 OutputString(string_value); | 46 OutputString(string_value); |
47 OutputString("\n"); | 47 OutputString("\n"); |
48 } else if (value->GetAsBoolean(&bool_value)) { | 48 } else if (value->GetAsBoolean(&bool_value)) { |
49 OutputString(indent); | 49 OutputString(indent); |
50 OutputString(bool_value ? "true" : "false"); | 50 OutputString(bool_value ? "true" : "false"); |
51 OutputString("\n"); | 51 OutputString("\n"); |
52 } else if (value->GetAsDictionary(&dict_value)) { | 52 } else if (value->GetAsDictionary(&dict_value)) { |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 if (!PrintConfig(config, what_to_print, !multiple_outputs)) | 501 if (!PrintConfig(config, what_to_print, !multiple_outputs)) |
502 return 1; | 502 return 1; |
503 } | 503 } |
504 } | 504 } |
505 | 505 |
506 return 0; | 506 return 0; |
507 } | 507 } |
508 | 508 |
509 } // namespace commands | 509 } // namespace commands |
OLD | NEW |