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 "chrome/browser/chromeos/system/syslogs_provider.h" | 5 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (!read_success) | 151 if (!read_success) |
152 return NULL; | 152 return NULL; |
153 | 153 |
154 // Parse the return data into a dictionary | 154 // Parse the return data into a dictionary |
155 LogDictionaryType* logs = new LogDictionaryType(); | 155 LogDictionaryType* logs = new LogDictionaryType(); |
156 while (data.length() > 0) { | 156 while (data.length() > 0) { |
157 std::string key = ReadKey(&data); | 157 std::string key = ReadKey(&data); |
158 base::TrimWhitespaceASCII(key, base::TRIM_ALL, &key); | 158 base::TrimWhitespaceASCII(key, base::TRIM_ALL, &key); |
159 if (!key.empty()) { | 159 if (!key.empty()) { |
160 std::string value = ReadValue(&data); | 160 std::string value = ReadValue(&data); |
161 if (base::IsStringUTF8(value)) { | 161 if (IsStringUTF8(value)) { |
162 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); | 162 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); |
163 if (value.empty()) | 163 if (value.empty()) |
164 (*logs)[key] = kEmptyLogEntry; | 164 (*logs)[key] = kEmptyLogEntry; |
165 else | 165 else |
166 (*logs)[key] = value; | 166 (*logs)[key] = value; |
167 } else { | 167 } else { |
168 LOG(WARNING) << "Invalid characters in system log entry: " << key; | 168 LOG(WARNING) << "Invalid characters in system log entry: " << key; |
169 (*logs)[key] = kInvalidLogEntry; | 169 (*logs)[key] = kInvalidLogEntry; |
170 } | 170 } |
171 } else { | 171 } else { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 return Singleton<SyslogsProviderImpl, | 399 return Singleton<SyslogsProviderImpl, |
400 DefaultSingletonTraits<SyslogsProviderImpl> >::get(); | 400 DefaultSingletonTraits<SyslogsProviderImpl> >::get(); |
401 } | 401 } |
402 | 402 |
403 SyslogsProvider* SyslogsProvider::GetInstance() { | 403 SyslogsProvider* SyslogsProvider::GetInstance() { |
404 return SyslogsProviderImpl::GetInstance(); | 404 return SyslogsProviderImpl::GetInstance(); |
405 } | 405 } |
406 | 406 |
407 } // namespace system | 407 } // namespace system |
408 } // namespace chromeos | 408 } // namespace chromeos |
OLD | NEW |