| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/api/log_private/log_parser.h" | 5 #include "chrome/browser/extensions/api/log_private/log_parser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/linked_ptr.h" | |
| 14 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 15 #include "chrome/browser/extensions/api/log_private/log_private_api.h" | 14 #include "chrome/browser/extensions/api/log_private/log_private_api.h" |
| 16 #include "chrome/common/extensions/api/log_private.h" | 15 #include "chrome/common/extensions/api/log_private.h" |
| 17 | 16 |
| 18 using std::string; | 17 using std::string; |
| 19 using std::vector; | 18 using std::vector; |
| 20 | 19 |
| 21 namespace extensions { | 20 namespace extensions { |
| 22 | 21 |
| 23 LogParser::LogParser() { | 22 LogParser::LogParser() { |
| 24 } | 23 } |
| 25 | 24 |
| 26 LogParser::~LogParser() { | 25 LogParser::~LogParser() { |
| 27 } | 26 } |
| 28 | 27 |
| 29 void LogParser::Parse( | 28 void LogParser::Parse(const string& input, |
| 30 const string& input, | 29 std::vector<api::log_private::LogEntry>* output, |
| 31 std::vector<linked_ptr<api::log_private::LogEntry> >* output, | 30 FilterHandler* filter_handler) const { |
| 32 FilterHandler* filter_handler) const { | |
| 33 // Assume there is no newline in the log entry | 31 // Assume there is no newline in the log entry |
| 34 std::vector<string> entries = base::SplitString( | 32 std::vector<string> entries = base::SplitString( |
| 35 input, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 33 input, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 36 | 34 |
| 37 for (size_t i = 0; i < entries.size(); i++) { | 35 for (size_t i = 0; i < entries.size(); i++) { |
| 38 ParseEntry(entries[i], output, filter_handler); | 36 ParseEntry(entries[i], output, filter_handler); |
| 39 } | 37 } |
| 40 } | 38 } |
| 41 | 39 |
| 42 } // namespace extensions | 40 } // namespace extensions |
| OLD | NEW |