| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_old.h" | 11 #include "base/callback.h" |
| 12 #include "content/browser/cancelable_request.h" | 12 #include "content/browser/cancelable_request.h" |
| 13 | 13 |
| 14 class CancelableRequestConsumerBase; | 14 class CancelableRequestConsumerBase; |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace system { | 17 namespace system { |
| 18 | 18 |
| 19 typedef std::map<std::string, std::string> LogDictionaryType; | 19 typedef std::map<std::string, std::string> LogDictionaryType; |
| 20 | 20 |
| 21 // This interface provides access to Chrome OS syslogs. | 21 // This interface provides access to Chrome OS syslogs. |
| 22 class SyslogsProvider : public CancelableRequestProvider { | 22 class SyslogsProvider : public CancelableRequestProvider { |
| 23 public: | 23 public: |
| 24 static SyslogsProvider* GetInstance(); | 24 static SyslogsProvider* GetInstance(); |
| 25 | 25 |
| 26 // The callback type used with RequestSyslogs(). | 26 // The callback type used with RequestSyslogs(). |
| 27 typedef Callback2<LogDictionaryType*, | 27 typedef base::Callback<void(LogDictionaryType*, |
| 28 std::string*>::Type ReadCompleteCallback; | 28 std::string*)> ReadCompleteCallback; |
| 29 | 29 |
| 30 // Used to specify the syslogs context with RequestSyslogs(). | 30 // Used to specify the syslogs context with RequestSyslogs(). |
| 31 enum SyslogsContext { | 31 enum SyslogsContext { |
| 32 SYSLOGS_FEEDBACK, | 32 SYSLOGS_FEEDBACK, |
| 33 SYSLOGS_SYSINFO, | 33 SYSLOGS_SYSINFO, |
| 34 SYSLOGS_NETWORK, | 34 SYSLOGS_NETWORK, |
| 35 SYSLOGS_DEFAULT | 35 SYSLOGS_DEFAULT |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Request system logs. Read happens on the FILE thread and callback is | 38 // Request system logs. Read happens on the FILE thread and callback is |
| 39 // called on the thread this is called from (via ForwardResult). | 39 // called on the thread this is called from (via ForwardResult). |
| 40 // Logs are owned by callback function (use delete when done with them). | 40 // Logs are owned by callback function (use delete when done with them). |
| 41 // Returns the request handle. Call CancelRequest(Handle) to cancel | 41 // Returns the request handle. Call CancelRequest(Handle) to cancel |
| 42 // the request before the callback gets called. | 42 // the request before the callback gets called. |
| 43 virtual Handle RequestSyslogs( | 43 virtual Handle RequestSyslogs( |
| 44 bool compress_logs, | 44 bool compress_logs, |
| 45 SyslogsContext context, | 45 SyslogsContext context, |
| 46 CancelableRequestConsumerBase* consumer, | 46 CancelableRequestConsumerBase* consumer, |
| 47 ReadCompleteCallback* callback) = 0; | 47 const ReadCompleteCallback& callback) = 0; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~SyslogsProvider() {} | 50 virtual ~SyslogsProvider() {} |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace system | 53 } // namespace system |
| 54 } // namespace chromeos | 54 } // namespace chromeos |
| 55 | 55 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_ |
| OLD | NEW |