Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / debug_info_collector.h
blob65aded99069fe904df98c9de13336ff5f9acf2ad
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "chrome/browser/chromeos/drive/file_system_interface.h"
12 namespace drive {
14 // This class provides some methods which are useful to show the debug
15 // info on chrome://drive-internals page.
16 // All the method should be called on UI thread.
17 class DebugInfoCollector {
18 public:
19 // Callback for ReadDirectory().
20 typedef base::Callback<void(FileError error,
21 scoped_ptr<ResourceEntryVector> entries)>
22 ReadDirectoryCallback;
24 // Callback for IterateFileCache().
25 typedef base::Callback<void(const std::string& id,
26 const FileCacheEntry& cache_entry)>
27 IterateFileCacheCallback;
29 DebugInfoCollector(internal::ResourceMetadata* metadata,
30 FileSystemInterface* file_system,
31 base::SequencedTaskRunner* blocking_task_runner);
32 ~DebugInfoCollector();
34 // Finds a locally stored entry (a file or a directory) by |file_path|.
35 // |callback| must not be null.
36 void GetResourceEntry(const base::FilePath& file_path,
37 const GetResourceEntryCallback& callback);
39 // Finds and reads a directory by |file_path|.
40 // |callback| must not be null.
41 void ReadDirectory(const base::FilePath& file_path,
42 const ReadDirectoryCallback& callback);
45 // Iterates all files in the file cache and calls |iteration_callback| for
46 // each file. |completion_callback| is run upon completion.
47 // |iteration_callback| and |completion_callback| must not be null.
48 void IterateFileCache(const IterateFileCacheCallback& iteration_callback,
49 const base::Closure& completion_callback);
51 // Returns miscellaneous metadata of the file system like the largest
52 // timestamp. |callback| must not be null.
53 void GetMetadata(const GetFilesystemMetadataCallback& callback);
55 private:
56 internal::ResourceMetadata* metadata_; // No owned.
57 FileSystemInterface* file_system_; // Not owned.
58 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
60 DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector);
63 } // namespace drive
65 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_