| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClientObserver); | 39 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClientObserver); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // This class is responsible for talking to the Drive service to get and put | 42 // This class is responsible for talking to the Drive service to get and put |
| 43 // Drive directories, files and metadata. | 43 // Drive directories, files and metadata. |
| 44 // This class is owned by DriveFileSyncService. | 44 // This class is owned by DriveFileSyncService. |
| 45 class DriveFileSyncClient | 45 class DriveFileSyncClient |
| 46 : public google_apis::DriveServiceObserver, | 46 : public google_apis::DriveServiceObserver, |
| 47 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 47 public net::NetworkChangeNotifier::NetworkChangeObserver, |
| 48 public base::NonThreadSafe, | 48 public base::NonThreadSafe, |
| 49 public base::SupportsWeakPtr<DriveFileSyncClient> { | 49 public base::SupportsWeakPtr<DriveFileSyncClient> { |
| 50 public: | 50 public: |
| 51 typedef base::Callback<void(google_apis::GDataErrorCode error)> | 51 typedef base::Callback<void(google_apis::GDataErrorCode error)> |
| 52 GDataErrorCallback; | 52 GDataErrorCallback; |
| 53 typedef base::Callback<void(google_apis::GDataErrorCode error, | 53 typedef base::Callback<void(google_apis::GDataErrorCode error, |
| 54 const std::string& file_md5)> | 54 const std::string& file_md5)> |
| 55 DownloadFileCallback; | 55 DownloadFileCallback; |
| 56 typedef base::Callback<void(google_apis::GDataErrorCode error, | 56 typedef base::Callback<void(google_apis::GDataErrorCode error, |
| 57 const std::string& resource_id, | 57 const std::string& resource_id, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 static std::string OriginToDirectoryTitle(const GURL& origin); | 172 static std::string OriginToDirectoryTitle(const GURL& origin); |
| 173 static GURL DirectoryTitleToOrigin(const std::string& title); | 173 static GURL DirectoryTitleToOrigin(const std::string& title); |
| 174 | 174 |
| 175 // Converts |resource_id| to corresponing resource link. | 175 // Converts |resource_id| to corresponing resource link. |
| 176 GURL ResourceIdToResourceLink(const std::string& resource_id) const; | 176 GURL ResourceIdToResourceLink(const std::string& resource_id) const; |
| 177 | 177 |
| 178 // DriveServiceObserver overrides. | 178 // DriveServiceObserver overrides. |
| 179 virtual void OnReadyToPerformOperations() OVERRIDE; | 179 virtual void OnReadyToPerformOperations() OVERRIDE; |
| 180 | 180 |
| 181 // ConnectionTypeObserver overrides. | 181 // NetworkChangeNotifier::NetworkChangeObserver overrides. |
| 182 virtual void OnConnectionTypeChanged( | 182 virtual void OnNetworkChanged( |
| 183 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 183 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 friend class DriveFileSyncClientTest; | 186 friend class DriveFileSyncClientTest; |
| 187 friend class DriveFileSyncServiceTest; | 187 friend class DriveFileSyncServiceTest; |
| 188 | 188 |
| 189 // Constructor for test use. | 189 // Constructor for test use. |
| 190 DriveFileSyncClient( | 190 DriveFileSyncClient( |
| 191 Profile* profile, | 191 Profile* profile, |
| 192 const GURL& base_url, | 192 const GURL& base_url, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 google_apis::GDataWapiUrlGenerator url_generator_; | 273 google_apis::GDataWapiUrlGenerator url_generator_; |
| 274 | 274 |
| 275 ObserverList<DriveFileSyncClientObserver> observers_; | 275 ObserverList<DriveFileSyncClientObserver> observers_; |
| 276 | 276 |
| 277 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); | 277 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 } // namespace sync_file_system | 280 } // namespace sync_file_system |
| 281 | 281 |
| 282 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ | 282 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ |
| OLD | NEW |