- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / drive / debug_info_collector.h
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_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "chrome/browser/chromeos/drive/file_cache.h"
11 #include "chrome/browser/chromeos/drive/file_system_interface.h"
12
13 namespace drive {
14
15 // This class provides some methods which are useful to show the debug
16 // info on chrome://drive-internals page.
17 // All the method should be called on UI thread.
18 class DebugInfoCollector {
19  public:
20   // Callback for IterateFileCache().
21   typedef base::Callback<void(const std::string& id,
22                               const FileCacheEntry& cache_entry)>
23       IterateFileCacheCallback;
24
25   DebugInfoCollector(FileSystemInterface* file_system,
26                      internal::FileCache* file_cache,
27                      base::SequencedTaskRunner* blocking_task_runner);
28   ~DebugInfoCollector();
29
30   // Iterates all files in the file cache and calls |iteration_callback| for
31   // each file. |completion_callback| is run upon completion.
32   // |iteration_callback| and |completion_callback| must not be null.
33   void IterateFileCache(const IterateFileCacheCallback& iteration_callback,
34                         const base::Closure& completion_callback);
35
36   // Returns miscellaneous metadata of the file system like the largest
37   // timestamp. |callback| must not be null.
38   void GetMetadata(const GetFilesystemMetadataCallback& callback);
39
40  private:
41   FileSystemInterface* file_system_;  // Not owned.
42   internal::FileCache* file_cache_;  // Not owned.
43   scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
44
45   DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector);
46 };
47
48 }  // namespace drive
49
50 #endif  // CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_