Home | History | Annotate | Download | only in drive
      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 
     11 using content::BrowserThread;
     12 
     13 namespace drive {
     14 
     15 DebugInfoCollector::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 
     23 DebugInfoCollector::~DebugInfoCollector() {
     24 }
     25 
     26 void 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 
     36 void 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 FileSystem.
     42   // TODO(hidehiko): Move the implementation to here to simplify the
     43   // FileSystem's implementation. crbug.com/237088
     44   file_system_->GetMetadata(callback);
     45 }
     46 
     47 }  // namespace drive
     48