debug_info_collector.cc revision b2df76ea8fec9e32f6f3718986dba0d95315b29c
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#include "chrome/browser/chromeos/drive/debug_info_collector.h"
6
7#include "base/callback.h"
8#include "base/logging.h"
9#include "content/public/browser/browser_thread.h"
10
11using content::BrowserThread;
12
13namespace drive {
14
15DebugInfoCollector::DebugInfoCollector(FileSystemInterface* file_system,
16                                       internal::FileCache* file_cache)
17    : file_system_(file_system),
18      file_cache_(file_cache) {
19  DCHECK(file_system_);
20  DCHECK(file_cache_);
21}
22
23DebugInfoCollector::~DebugInfoCollector() {
24}
25
26void DebugInfoCollector::IterateFileCache(
27    const CacheIterateCallback& iteration_callback,
28    const base::Closure& completion_callback) {
29  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
30  DCHECK(!iteration_callback.is_null());
31  DCHECK(!completion_callback.is_null());
32
33  file_cache_->IterateOnUIThread(iteration_callback, completion_callback);
34}
35
36void DebugInfoCollector::GetMetadata(
37    const GetFilesystemMetadataCallback& callback) {
38  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
39  DCHECK(!callback.is_null());
40
41  // Currently, this is just a proxy to the DriveFileSystem.
42  // TODO(hidehiko): Move the implementation to here to simplify the
43  // DriveFileSystem's implementation. crbug.com/237088
44  file_system_->GetMetadata(callback);
45}
46
47}  // namespace drive
48