Home | History | Annotate | Download | only in drive
      1 // Copyright (c) 2012 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/drive/dummy_drive_service.h"
      6 
      7 #include "base/bind.h"
      8 #include "chrome/browser/drive/drive_api_util.h"
      9 
     10 using google_apis::AboutResourceCallback;
     11 using google_apis::AppListCallback;
     12 using google_apis::AuthStatusCallback;
     13 using google_apis::AuthorizeAppCallback;
     14 using google_apis::CancelCallback;
     15 using google_apis::DownloadActionCallback;
     16 using google_apis::EntryActionCallback;
     17 using google_apis::GetContentCallback;
     18 using google_apis::GetResourceEntryCallback;
     19 using google_apis::GetResourceListCallback;
     20 using google_apis::GetShareUrlCallback;
     21 using google_apis::InitiateUploadCallback;
     22 using google_apis::ProgressCallback;
     23 using google_apis::UploadRangeCallback;
     24 
     25 namespace drive {
     26 
     27 DummyDriveService::DummyDriveService() {}
     28 
     29 DummyDriveService::~DummyDriveService() {}
     30 
     31 void DummyDriveService::Initialize(const std::string& account_id) {}
     32 
     33 void DummyDriveService::AddObserver(DriveServiceObserver* observer) {}
     34 
     35 void DummyDriveService::RemoveObserver(DriveServiceObserver* observer) {}
     36 
     37 bool DummyDriveService::CanSendRequest() const { return true; }
     38 
     39 ResourceIdCanonicalizer DummyDriveService::GetResourceIdCanonicalizer() const {
     40   return util::GetIdentityResourceIdCanonicalizer();
     41 }
     42 
     43 bool DummyDriveService::HasAccessToken() const { return true; }
     44 
     45 void DummyDriveService::RequestAccessToken(const AuthStatusCallback& callback) {
     46   callback.Run(google_apis::HTTP_NOT_MODIFIED, "fake_access_token");
     47 }
     48 
     49 bool DummyDriveService::HasRefreshToken() const { return true; }
     50 
     51 void DummyDriveService::ClearAccessToken() { }
     52 
     53 void DummyDriveService::ClearRefreshToken() { }
     54 
     55 std::string DummyDriveService::GetRootResourceId() const {
     56   return "dummy_root";
     57 }
     58 
     59 CancelCallback DummyDriveService::GetAllResourceList(
     60     const GetResourceListCallback& callback) { return CancelCallback(); }
     61 
     62 CancelCallback DummyDriveService::GetResourceListInDirectory(
     63     const std::string& directory_resource_id,
     64     const GetResourceListCallback& callback) { return CancelCallback(); }
     65 
     66 CancelCallback DummyDriveService::Search(
     67     const std::string& search_query,
     68     const GetResourceListCallback& callback) { return CancelCallback(); }
     69 
     70 CancelCallback DummyDriveService::SearchByTitle(
     71     const std::string& title,
     72     const std::string& directory_resource_id,
     73     const GetResourceListCallback& callback) { return CancelCallback(); }
     74 
     75 CancelCallback DummyDriveService::GetChangeList(
     76     int64 start_changestamp,
     77     const GetResourceListCallback& callback) { return CancelCallback(); }
     78 
     79 CancelCallback DummyDriveService::GetRemainingChangeList(
     80     const GURL& next_link,
     81     const GetResourceListCallback& callback) { return CancelCallback(); }
     82 
     83 CancelCallback DummyDriveService::GetRemainingFileList(
     84     const GURL& next_link,
     85     const GetResourceListCallback& callback) { return CancelCallback(); }
     86 
     87 CancelCallback DummyDriveService::GetResourceEntry(
     88     const std::string& resource_id,
     89     const GetResourceEntryCallback& callback) { return CancelCallback(); }
     90 
     91 CancelCallback DummyDriveService::GetShareUrl(
     92     const std::string& resource_id,
     93     const GURL& embed_origin,
     94     const GetShareUrlCallback& callback) { return CancelCallback(); }
     95 
     96 CancelCallback DummyDriveService::GetAboutResource(
     97     const AboutResourceCallback& callback) { return CancelCallback(); }
     98 
     99 CancelCallback DummyDriveService::GetAppList(
    100     const AppListCallback& callback) { return CancelCallback(); }
    101 
    102 CancelCallback DummyDriveService::DeleteResource(
    103     const std::string& resource_id,
    104     const std::string& etag,
    105     const EntryActionCallback& callback) { return CancelCallback(); }
    106 
    107 CancelCallback DummyDriveService::TrashResource(
    108     const std::string& resource_id,
    109     const EntryActionCallback& callback) { return CancelCallback(); }
    110 
    111 CancelCallback DummyDriveService::DownloadFile(
    112     const base::FilePath& local_cache_path,
    113     const std::string& resource_id,
    114     const DownloadActionCallback& download_action_callback,
    115     const GetContentCallback& get_content_callback,
    116     const ProgressCallback& progress_callback) { return CancelCallback(); }
    117 
    118 CancelCallback DummyDriveService::CopyResource(
    119     const std::string& resource_id,
    120     const std::string& parent_resource_id,
    121     const std::string& new_title,
    122     const base::Time& last_modified,
    123     const GetResourceEntryCallback& callback) { return CancelCallback(); }
    124 
    125 CancelCallback DummyDriveService::UpdateResource(
    126     const std::string& resource_id,
    127     const std::string& parent_resource_id,
    128     const std::string& new_title,
    129     const base::Time& last_modified,
    130     const base::Time& last_viewed_by_me,
    131     const google_apis::GetResourceEntryCallback& callback) {
    132   return CancelCallback();
    133 }
    134 
    135 CancelCallback DummyDriveService::RenameResource(
    136     const std::string& resource_id,
    137     const std::string& new_title,
    138     const EntryActionCallback& callback) { return CancelCallback(); }
    139 
    140 CancelCallback DummyDriveService::AddResourceToDirectory(
    141     const std::string& parent_resource_id,
    142     const std::string& resource_id,
    143     const EntryActionCallback& callback) { return CancelCallback(); }
    144 
    145 CancelCallback DummyDriveService::RemoveResourceFromDirectory(
    146     const std::string& parent_resource_id,
    147     const std::string& resource_id,
    148     const EntryActionCallback& callback) { return CancelCallback(); }
    149 
    150 CancelCallback DummyDriveService::AddNewDirectory(
    151     const std::string& parent_resource_id,
    152     const std::string& directory_title,
    153     const GetResourceEntryCallback& callback) { return CancelCallback(); }
    154 
    155 CancelCallback DummyDriveService::InitiateUploadNewFile(
    156     const std::string& content_type,
    157     int64 content_length,
    158     const std::string& parent_resource_id,
    159     const std::string& title,
    160     const InitiateUploadCallback& callback) { return CancelCallback(); }
    161 
    162 CancelCallback DummyDriveService::InitiateUploadExistingFile(
    163     const std::string& content_type,
    164     int64 content_length,
    165     const std::string& resource_id,
    166     const std::string& etag,
    167     const InitiateUploadCallback& callback) { return CancelCallback(); }
    168 
    169 CancelCallback DummyDriveService::ResumeUpload(
    170     const GURL& upload_url,
    171     int64 start_position,
    172     int64 end_position,
    173     int64 content_length,
    174     const std::string& content_type,
    175     const base::FilePath& local_file_path,
    176     const UploadRangeCallback& callback,
    177     const ProgressCallback& progress_callback) { return CancelCallback(); }
    178 
    179 CancelCallback DummyDriveService::GetUploadStatus(
    180     const GURL& upload_url,
    181     int64 content_length,
    182     const UploadRangeCallback& callback) { return CancelCallback(); }
    183 
    184 CancelCallback DummyDriveService::AuthorizeApp(
    185     const std::string& resource_id,
    186     const std::string& app_id,
    187     const AuthorizeAppCallback& callback) { return CancelCallback(); }
    188 
    189 CancelCallback DummyDriveService::GetResourceListInDirectoryByWapi(
    190     const std::string& directory_resource_id,
    191     const GetResourceListCallback& callback) { return CancelCallback(); }
    192 
    193 CancelCallback DummyDriveService::GetRemainingResourceList(
    194     const GURL& next_link,
    195     const GetResourceListCallback& callback) { return CancelCallback(); }
    196 
    197 }  // namespace drive
    198