drive_service_interface.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#ifndef CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ 67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#define CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/time/time.h" 11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "google_apis/drive/auth_service_interface.h" 12a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "google_apis/drive/base_requests.h" 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "google_apis/drive/drive_api_requests.h" 14a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "google_apis/drive/drive_common_callbacks.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace base { 17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class Time; 18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} 19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 20eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochnamespace drive { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Function which converts the given resource ID into the desired format. 23d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)typedef base::Callback<std::string( 24d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) const std::string& resource_id)> ResourceIdCanonicalizer; 25d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Observer interface for DriveServiceInterface. 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DriveServiceObserver { 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Triggered when the service gets ready to send requests. 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual void OnReadyToSendRequests() {} 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Called when the refresh token was found to be invalid. 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnRefreshTokenInvalid() {} 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~DriveServiceObserver() {} 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This defines an interface for sharing by DriveService and MockDriveService 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// so that we can do testing of clients of DriveService. 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// All functions must be called on UI thread. DriveService is built on top of 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// URLFetcher that runs on UI thread. 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DriveServiceInterface { 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Optional parameters for AddNewDirectory(). 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct AddNewDirectoryOptions { 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) AddNewDirectoryOptions(); 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ~AddNewDirectoryOptions(); 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // modified_date of the directory. 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time modified_date; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // last_viewed_by_me_date of the directory. 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time last_viewed_by_me_date; 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }; 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Optional parameters for InitiateUploadNewFile(). 615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct InitiateUploadNewFileOptions { 625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) InitiateUploadNewFileOptions(); 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ~InitiateUploadNewFileOptions(); 645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // modified_date of the file. 665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time modified_date; 685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // last_viewed_by_me_date of the file. 705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time last_viewed_by_me_date; 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }; 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Optional parameters for InitiateUploadExistingFile(). 755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct InitiateUploadExistingFileOptions { 765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) InitiateUploadExistingFileOptions(); 775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ~InitiateUploadExistingFileOptions(); 785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Expected ETag of the file. UPLOAD_ERROR_CONFLICT error is generated when 805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // matching fails. 815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the empty string to disable this behavior. 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::string etag; 835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // New parent of the file. 855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the empty string to keep the property unchanged. 865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::string parent_resource_id; 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // New title of the file. 895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the empty string to keep the property unchanged. 905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::string title; 915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // New modified_date of the file. 935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time modified_date; 955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // New last_viewed_by_me_date of the file. 975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Pass the null Time if you are not interested in setting this property. 985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Time last_viewed_by_me_date; 995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }; 1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~DriveServiceInterface() {} 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Common service: 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 10568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // Initializes the documents service with |account_id|. 10668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) virtual void Initialize(const std::string& account_id) = 0; 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Adds an observer. 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void AddObserver(DriveServiceObserver* observer) = 0; 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Removes an observer. 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void RemoveObserver(DriveServiceObserver* observer) = 0; 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 114868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // True if ready to send requests. 115868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual bool CanSendRequest() const = 0; 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 117d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Returns a function which converts the given resource ID into the desired 118d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // format. 119d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) virtual ResourceIdCanonicalizer GetResourceIdCanonicalizer() const = 0; 12090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Authentication service: 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if OAuth2 access token is retrieved and believed to be fresh. 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool HasAccessToken() const = 0; 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Gets the cached OAuth2 access token or if empty, then fetches a new one. 1277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual void RequestAccessToken( 1287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const google_apis::AuthStatusCallback& callback) = 0; 1297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if OAuth2 refresh token is present. 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool HasRefreshToken() const = 0; 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Clears OAuth2 access token. 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void ClearAccessToken() = 0; 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Clears OAuth2 refresh token. 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void ClearRefreshToken() = 0; 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Document access: 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns the resource id for the root directory. 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual std::string GetRootResourceId() const = 0; 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 144c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Fetches a resource list of the account. |callback| will be called upon 145c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // completion. 146c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the list is too long, it may be paged. In such a case, a URL to fetch 147c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // remaining results will be included in the returned result. See also 148f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // GetRemainingFileList. 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 150c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |callback| must not be null. 151eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetAllResourceList( 152eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceListCallback& callback) = 0; 153c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 154c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Fetches a resource list in the directory with |directory_resource_id|. 155c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |callback| will be called upon completion. 156c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the list is too long, it may be paged. In such a case, a URL to fetch 157c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // remaining results will be included in the returned result. See also 158f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // GetRemainingFileList. 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 160c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |directory_resource_id| must not be empty. 161c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |callback| must not be null. 162eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetResourceListInDirectory( 163c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& directory_resource_id, 164eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceListCallback& callback) = 0; 165c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 166c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Searches the resources for the |search_query| from all the user's 167c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // resources. |callback| will be called upon completion. 168c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the list is too long, it may be paged. In such a case, a URL to fetch 169c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // remaining results will be included in the returned result. See also 170f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // GetRemainingFileList. 171c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // 172c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |search_query| must not be empty. 173c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |callback| must not be null. 174eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback Search( 175c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& search_query, 176eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceListCallback& callback) = 0; 177c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 178c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Searches the resources with the |title|. 1797d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // |directory_resource_id| is an optional parameter. If it is empty, 180c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // the search target is all the existing resources. Otherwise, it is 181c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // the resources directly under the directory with |directory_resource_id|. 182c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the list is too long, it may be paged. In such a case, a URL to fetch 183c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // remaining results will be included in the returned result. See also 184f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // GetRemainingFileList. 185c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // 186c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |title| must not be empty, and |callback| must not be null. 187eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback SearchByTitle( 188c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& title, 189c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& directory_resource_id, 190eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceListCallback& callback) = 0; 191c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 192c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Fetches change list since |start_changestamp|. |callback| will be 193c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // called upon completion. 194c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the list is too long, it may be paged. In such a case, a URL to fetch 195c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // remaining results will be included in the returned result. See also 196f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // GetRemainingChangeList. 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 199eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetChangeList( 200c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int64 start_changestamp, 201eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceListCallback& callback) = 0; 202c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 203424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The result of GetChangeList() and GetAllResourceList() may be paged. 20458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // In such a case, a next link to fetch remaining result is returned. 205424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The page token can be used for this method. |callback| will be called upon 206424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // completion. 207424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // 20858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // |next_link| must not be empty. |callback| must not be null. 209424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) virtual google_apis::CancelCallback GetRemainingChangeList( 21058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const GURL& next_link, 211424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const google_apis::GetResourceListCallback& callback) = 0; 212424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 213424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The result of GetResourceListInDirectory(), Search() and SearchByTitle() 21458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // may be paged. In such a case, a next link to fetch remaining result is 215424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // returned. The page token can be used for this method. |callback| will be 216424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // called upon completion. 217424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // 21858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // |next_link| must not be empty. |callback| must not be null. 219424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) virtual google_apis::CancelCallback GetRemainingFileList( 22058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const GURL& next_link, 221424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const google_apis::GetResourceListCallback& callback) = 0; 222424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Fetches single entry metadata from server. The entry's resource id equals 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |resource_id|. 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 227eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetResourceEntry( 2287d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& resource_id, 229eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceEntryCallback& callback) = 0; 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 231bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch // Fetches an url for the sharing dialog for a single entry with id 232bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch // |resource_id|, to be embedded in a webview or an iframe with origin 233bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch // |embed_origin|. The url is returned via |callback| with results on the 234bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch // calling thread. |callback| must not be null. 235bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch virtual google_apis::CancelCallback GetShareUrl( 236bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch const std::string& resource_id, 237bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch const GURL& embed_origin, 238bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch const google_apis::GetShareUrlCallback& callback) = 0; 239bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch 2402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Gets the about resource information from the server. 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 243eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetAboutResource( 244424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const google_apis::AboutResourceCallback& callback) = 0; 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Gets the application information from the server. 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 249eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetAppList( 250424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const google_apis::AppListCallback& callback) = 0; 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Permanently deletes a resource identified by its |resource_id|. 2532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // If |etag| is not empty and did not match, the deletion fails with 2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // HTTP_PRECONDITION error. 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 257eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback DeleteResource( 2587d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& resource_id, 2597d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& etag, 260eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::EntryActionCallback& callback) = 0; 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Trashes a resource identified by its |resource_id|. 2635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // |callback| must not be null. 2655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual google_apis::CancelCallback TrashResource( 2665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& resource_id, 2675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const google_apis::EntryActionCallback& callback) = 0; 2685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 26990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Makes a copy of a resource with |resource_id|. 27090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // The new resource will be put under a directory with |parent_resource_id|, 2717dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // and it'll be named |new_title|. 27268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // If |last_modified| is not null, the modified date of the resource on the 27368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // server will be set to the date. 274868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // This request is supported only on DriveAPIService, because GData WAPI 27590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // doesn't support the function unfortunately. 27690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 27790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // |callback| must not be null. 278eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback CopyResource( 2797d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& resource_id, 2807d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& parent_resource_id, 2817dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const std::string& new_title, 28268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) const base::Time& last_modified, 283eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceEntryCallback& callback) = 0; 28490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 285f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Updates a resource with |resource_id| to the directory of 2863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // |parent_resource_id| with renaming to |new_title|. 287f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // If |last_modified| or |last_accessed| is not null, the modified/accessed 288f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // date of the resource on the server will be set to the date. 2893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // This request is supported only on DriveAPIService, because GData WAPI 2903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // doesn't support the function unfortunately. 2913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 2923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // |callback| must not be null. 293f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual google_apis::CancelCallback UpdateResource( 2943551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) const std::string& resource_id, 2953551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) const std::string& parent_resource_id, 2963551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) const std::string& new_title, 29768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) const base::Time& last_modified, 298f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const base::Time& last_viewed_by_me, 2993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) const google_apis::GetResourceEntryCallback& callback) = 0; 3003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 3012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Renames a document or collection identified by its |resource_id| 3027dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // to the UTF-8 encoded |new_title|. Upon completion, 3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // invokes |callback| with results on the calling thread. 3042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 305eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback RenameResource( 306eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const std::string& resource_id, 3077dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const std::string& new_title, 308eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::EntryActionCallback& callback) = 0; 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Adds a resource (document, file, or collection) identified by its 3112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |resource_id| to a collection represented by the |parent_resource_id|. 3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 3132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 314eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback AddResourceToDirectory( 3157d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& parent_resource_id, 3167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& resource_id, 317eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::EntryActionCallback& callback) = 0; 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Removes a resource (document, file, collection) identified by its 3202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |resource_id| from a collection represented by the |parent_resource_id|. 3212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Upon completion, invokes |callback| with results on the calling thread. 3222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 323eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback RemoveResourceFromDirectory( 3242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& parent_resource_id, 3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& resource_id, 326eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::EntryActionCallback& callback) = 0; 3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Adds new collection with |directory_title| under parent directory 3292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // identified with |parent_resource_id|. |parent_resource_id| can be the 3302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // value returned by GetRootResourceId to represent the root directory. 3312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Upon completion, invokes |callback| and passes newly created entry on 3322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the calling thread. 3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // This function cannot be named as "CreateDirectory" as it conflicts with 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // a macro on Windows. 3352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 336eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback AddNewDirectory( 3377d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& parent_resource_id, 3387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const std::string& directory_title, 3395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const AddNewDirectoryOptions& options, 340eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetResourceEntryCallback& callback) = 0; 3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 342eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Downloads a file with |resourced_id|. The downloaded file will 3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // be stored at |local_cache_path| location. Upon completion, invokes 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |download_action_callback| with results on the calling thread. 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If |get_content_callback| is not empty, 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // URLFetcherDelegate::OnURLFetchDownloadData will be called, which will in 3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // turn invoke |get_content_callback| on the calling thread. 348c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If |progress_callback| is not empty, it is invoked periodically when 349c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // the download made some progress. 3502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 3512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |download_action_callback| must not be null. 352c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |get_content_callback| and |progress_callback| may be null. 353eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback DownloadFile( 3542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const base::FilePath& local_cache_path, 355eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const std::string& resource_id, 356eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::DownloadActionCallback& download_action_callback, 357eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::GetContentCallback& get_content_callback, 358eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::ProgressCallback& progress_callback) = 0; 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Initiates uploading of a new document/file. 3612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |content_type| and |content_length| should be the ones of the file to be 3622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // uploaded. 3632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 364eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback InitiateUploadNewFile( 3652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& content_type, 3662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 content_length, 3672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& parent_resource_id, 3682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& title, 3695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const InitiateUploadNewFileOptions& options, 370eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::InitiateUploadCallback& callback) = 0; 3712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Initiates uploading of an existing document/file. 3732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |content_type| and |content_length| should be the ones of the file to be 3742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // uploaded. 3752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 376eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback InitiateUploadExistingFile( 3772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& content_type, 3782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 content_length, 3792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& resource_id, 3805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const InitiateUploadExistingFileOptions& options, 381eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::InitiateUploadCallback& callback) = 0; 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Resumes uploading of a document/file on the calling thread. 384c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |callback| must not be null. |progress_callback| may be null. 385eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback ResumeUpload( 3862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const GURL& upload_url, 3872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 start_position, 3882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 end_position, 3892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 content_length, 3902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& content_type, 391a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const base::FilePath& local_file_path, 392eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::UploadRangeCallback& callback, 393eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::ProgressCallback& progress_callback) = 0; 3942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Gets the current status of the uploading to |upload_url| from the server. 39690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // |drive_file_path| and |content_length| should be set to the same value 39790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // which is used for ResumeUpload. 3982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |callback| must not be null. 399eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback GetUploadStatus( 4002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const GURL& upload_url, 4012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int64 content_length, 402eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::UploadRangeCallback& callback) = 0; 4032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Authorizes a Drive app with the id |app_id| to open the given file. 4052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Upon completion, invokes |callback| with the link to open the file with 4062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the provided app. |callback| must not be null. 407eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual google_apis::CancelCallback AuthorizeApp( 4087d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& resource_id, 4097d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& app_id, 410eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const google_apis::AuthorizeAppCallback& callback) = 0; 41158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 4125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Uninstalls a Drive app with the id |app_id|. |callback| must not be null. 4135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual google_apis::CancelCallback UninstallApp( 4145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& app_id, 4155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const google_apis::EntryActionCallback& callback) = 0; 4165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 41758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // This is introduced as a temporary short term solution of the performance 41858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // regression issue on Drive API v2. 41958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // 4205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // This fetches the resource list in a directory by using GData WAPI 4215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // regardless of base protocol. In other words, even if we enables Drive API 42258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // v2, this method uses GData WAPI to fetch the resource list. 42358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // 42458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // |directory_resource_id| must not be empty. 42558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // |callback| must not be null. 42658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual google_apis::CancelCallback GetResourceListInDirectoryByWapi( 42758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const std::string& directory_resource_id, 42858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const google_apis::GetResourceListCallback& callback) = 0; 42958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 43058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // GetResourceListInDirectoryByWapi can be paged. This method fetches the 43158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // following pages. 43258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // 43358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // |callback| must not be null. 43458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual google_apis::CancelCallback GetRemainingResourceList( 43558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const GURL& next_link, 43658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const google_apis::GetResourceListCallback& callback) = 0; 437a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 438a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Authorizes the account |email| to access |resource_id| as a |role|. 439a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // 440a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // |callback| must not be null. 441a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual google_apis::CancelCallback AddPermission( 442a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const std::string& resource_id, 443a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const std::string& email, 444a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) google_apis::drive::PermissionRole role, 445a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const google_apis::EntryActionCallback& callback) = 0; 4465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 448eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch} // namespace drive 4495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4507d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif // CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ 451