Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/api_util.h" | 5 #include "chrome/browser/sync_file_system/drive/api_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/google_apis/drive_api_parser.h" | 15 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 16 #include "chrome/browser/google_apis/drive_uploader.h" | 16 #include "chrome/browser/google_apis/drive_uploader.h" |
| 17 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
| 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/sync_file_system/logger.h" | |
| 20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 21 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
| 22 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
| 23 #include "net/base/mime_util.h" | 24 #include "net/base/mime_util.h" |
| 24 #include "webkit/fileapi/syncable/syncable_file_system_util.h" | 25 #include "webkit/fileapi/syncable/syncable_file_system_util.h" |
| 25 | 26 |
| 26 namespace sync_file_system { | 27 namespace sync_file_system { |
| 27 namespace drive { | 28 namespace drive { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 return; | 301 return; |
| 301 } | 302 } |
| 302 | 303 |
| 303 if (status == NO_DUPLICATES_FOUND) | 304 if (status == NO_DUPLICATES_FOUND) |
| 304 error = google_apis::HTTP_CREATED; | 305 error = google_apis::HTTP_CREATED; |
| 305 | 306 |
| 306 DCHECK(entry) << "No entry: " << error; | 307 DCHECK(entry) << "No entry: " << error; |
| 307 | 308 |
| 308 if (!entry->is_folder()) { | 309 if (!entry->is_folder()) { |
| 309 // TODO(kinuko): Fix this. http://crbug.com/237090 | 310 // TODO(kinuko): Fix this. http://crbug.com/237090 |
| 310 LOG(ERROR) << "A file is left for CreateDirectory due to " | 311 util::Log(logging::LOG_ERROR, |
|
nhiroki
2013/05/22 05:42:40
nit: Can you align the arguments?
calvinlo
2013/05/22 08:42:56
Done.
| |
| 311 << "file-folder conflict!"; | 312 "A file is left for CreateDirectory due to file-folder conflict!"); |
| 312 callback.Run(google_apis::HTTP_CONFLICT, std::string()); | 313 callback.Run(google_apis::HTTP_CONFLICT, std::string()); |
| 313 return; | 314 return; |
| 314 } | 315 } |
| 315 | 316 |
| 316 if (entry->title() == GetSyncRootDirectoryName()) | 317 if (entry->title() == GetSyncRootDirectoryName()) |
| 317 EnsureSyncRootIsNotInMyDrive(entry->resource_id()); | 318 EnsureSyncRootIsNotInMyDrive(entry->resource_id()); |
| 318 | 319 |
| 319 callback.Run(error, entry->resource_id()); | 320 callback.Run(error, entry->resource_id()); |
| 320 } | 321 } |
| 321 | 322 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 iter != upload_callback_map_.end(); | 972 iter != upload_callback_map_.end(); |
| 972 ++iter) { | 973 ++iter) { |
| 973 iter->second.Run(error, std::string(), std::string()); | 974 iter->second.Run(error, std::string(), std::string()); |
| 974 } | 975 } |
| 975 upload_callback_map_.clear(); | 976 upload_callback_map_.clear(); |
| 976 drive_uploader_.reset(new google_apis::DriveUploader(drive_service_.get())); | 977 drive_uploader_.reset(new google_apis::DriveUploader(drive_service_.get())); |
| 977 } | 978 } |
| 978 | 979 |
| 979 } // namespace drive | 980 } // namespace drive |
| 980 } // namespace sync_file_system | 981 } // namespace sync_file_system |
| OLD | NEW |