| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_LOG_PARSER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_LOG_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "chrome/browser/extensions/api/log_private/filter_handler.h" | |
| 13 #include "chrome/common/extensions/api/log_private.h" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 // This is a abstract class of parsers for different logs. | |
| 18 // All the specific parsers inherit from this class. | |
| 19 class LogParser { | |
| 20 public: | |
| 21 enum Error { | |
| 22 SUCCESS = 0, | |
| 23 PARSE_ERROR = -1, | |
| 24 SERIALIZE_ERROR = -2, | |
| 25 TOKENIZE_ERROR = -3 | |
| 26 }; | |
| 27 | |
| 28 virtual ~LogParser(); | |
| 29 // Parses log text into multiple LogEntry objects. | |
| 30 void Parse(const std::string& input, | |
| 31 std::vector<api::log_private::LogEntry>* output, | |
| 32 FilterHandler* filter_handler) const; | |
| 33 | |
| 34 protected: | |
| 35 LogParser(); | |
| 36 // Parses a single line of log text into one LogEntry object. | |
| 37 virtual Error ParseEntry(const std::string& input, | |
| 38 std::vector<api::log_private::LogEntry>* output, | |
| 39 FilterHandler* filter_handler) const = 0; | |
| 40 | |
| 41 private: | |
| 42 DISALLOW_COPY_AND_ASSIGN(LogParser); | |
| 43 }; | |
| 44 | |
| 45 } // namespace extensions | |
| 46 | |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_LOG_PARSER_H_ | |
| OLD | NEW |