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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_CHROMEOS_CROS_SYSLOGS_LIBRARY_H_ 6#define CHROME_BROWSER_CHROMEOS_CROS_SYSLOGS_LIBRARY_H_ 7#pragma once 8 9#include "base/memory/singleton.h" 10#include "content/browser/cancelable_request.h" 11#include "third_party/cros/chromeos_syslogs.h" 12 13class CancelableRequestConsumerBase; 14 15namespace chromeos { 16 17// This interface defines interaction with the ChromeOS syslogs APIs. 18class SyslogsLibrary : public CancelableRequestProvider { 19 public: 20 typedef Callback2<LogDictionaryType*, 21 std::string*>::Type ReadCompleteCallback; 22 23 SyslogsLibrary() {} 24 virtual ~SyslogsLibrary() {} 25 26 // Request system logs. Read happens on the FILE thread and callback is 27 // called on the thread this is called from (via ForwardResult). 28 // Logs are owned by callback function (use delete when done with them). 29 // Returns the request handle. Call CancelRequest(Handle) to cancel 30 // the request before the callback gets called. 31 virtual Handle RequestSyslogs( 32 bool compress_logs, bool feedback_context, 33 CancelableRequestConsumerBase* consumer, 34 ReadCompleteCallback* callback) = 0; 35 36 // Factory function, creates a new instance and returns ownership. 37 // For normal usage, access the singleton via CrosLibrary::Get(). 38 static SyslogsLibrary* GetImpl(bool stub); 39}; 40 41} // namespace chromeos 42 43#endif // CHROME_BROWSER_CHROMEOS_CROS_SYSLOGS_LIBRARY_H_ 44