| 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 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/google_apis/drive_uploader.h" | 12 #include "chrome/browser/google_apis/drive_uploader.h" |
| 13 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 13 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
| 14 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 14 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
| 15 #include "net/base/mime_util.h" | 16 #include "net/base/mime_util.h" |
| 16 | 17 |
| 17 namespace sync_file_system { | 18 namespace sync_file_system { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const char kRootResourceId[] = ""; | 22 const char kRootResourceId[] = ""; |
| 22 const char kSyncRootDirectoryName[] = "Chrome Syncable FileSystem"; | 23 const char kSyncRootDirectoryName[] = "Chrome Syncable FileSystem"; |
| 23 const char kResourceLinkPrefix[] = | 24 const char kResourceLinkPrefix[] = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 HasParentLinkTo((*itr)->links(), parent_resource_id)) { | 57 HasParentLinkTo((*itr)->links(), parent_resource_id)) { |
| 57 return *itr; | 58 return *itr; |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 return NULL; | 61 return NULL; |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace | 64 } // namespace |
| 64 | 65 |
| 65 DriveFileSyncClient::DriveFileSyncClient(Profile* profile) { | 66 DriveFileSyncClient::DriveFileSyncClient(Profile* profile) { |
| 66 drive_service_.reset(new google_apis::GDataWapiService); | 67 drive_service_.reset(new google_apis::GDataWapiService( |
| 68 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction))); |
| 67 drive_service_->Initialize(profile); | 69 drive_service_->Initialize(profile); |
| 68 | 70 |
| 69 drive_uploader_.reset(new google_apis::DriveUploader(drive_service_.get())); | 71 drive_uploader_.reset(new google_apis::DriveUploader(drive_service_.get())); |
| 70 } | 72 } |
| 71 | 73 |
| 72 scoped_ptr<DriveFileSyncClient> DriveFileSyncClient::CreateForTesting( | 74 scoped_ptr<DriveFileSyncClient> DriveFileSyncClient::CreateForTesting( |
| 73 Profile* profile, | 75 Profile* profile, |
| 74 scoped_ptr<google_apis::DriveServiceInterface> drive_service, | 76 scoped_ptr<google_apis::DriveServiceInterface> drive_service, |
| 75 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader) { | 77 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader) { |
| 76 return make_scoped_ptr(new DriveFileSyncClient( | 78 return make_scoped_ptr(new DriveFileSyncClient( |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 588 |
| 587 void DriveFileSyncClient::DidDeleteFile( | 589 void DriveFileSyncClient::DidDeleteFile( |
| 588 const GDataErrorCallback& callback, | 590 const GDataErrorCallback& callback, |
| 589 google_apis::GDataErrorCode error, | 591 google_apis::GDataErrorCode error, |
| 590 const GURL& document_url) { | 592 const GURL& document_url) { |
| 591 DCHECK(CalledOnValidThread()); | 593 DCHECK(CalledOnValidThread()); |
| 592 callback.Run(error); | 594 callback.Run(error); |
| 593 } | 595 } |
| 594 | 596 |
| 595 } // namespace sync_file_system | 597 } // namespace sync_file_system |
| OLD | NEW |