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_api_service.h" | 16 #include "chrome/browser/google_apis/drive_api_service.h" |
17 #include "chrome/browser/google_apis/drive_uploader.h" | 17 #include "chrome/browser/google_apis/drive_uploader.h" |
18 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 18 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
19 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 19 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" | 21 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" |
| 22 #include "chrome/browser/sync_file_system/logger.h" |
22 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
23 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
24 #include "net/base/escape.h" | 25 #include "net/base/escape.h" |
25 #include "net/base/mime_util.h" | 26 #include "net/base/mime_util.h" |
26 #include "webkit/fileapi/syncable/syncable_file_system_util.h" | 27 #include "webkit/fileapi/syncable/syncable_file_system_util.h" |
27 | 28 |
28 namespace sync_file_system { | 29 namespace sync_file_system { |
29 namespace drive { | 30 namespace drive { |
30 | 31 |
31 namespace { | 32 namespace { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 return; | 362 return; |
362 } | 363 } |
363 | 364 |
364 if (status == NO_DUPLICATES_FOUND) | 365 if (status == NO_DUPLICATES_FOUND) |
365 error = google_apis::HTTP_CREATED; | 366 error = google_apis::HTTP_CREATED; |
366 | 367 |
367 DCHECK(entry) << "No entry: " << error; | 368 DCHECK(entry) << "No entry: " << error; |
368 | 369 |
369 if (!entry->is_folder()) { | 370 if (!entry->is_folder()) { |
370 // TODO(kinuko): Fix this. http://crbug.com/237090 | 371 // TODO(kinuko): Fix this. http://crbug.com/237090 |
371 LOG(ERROR) << "A file is left for CreateDirectory due to " | 372 util::Log( |
372 << "file-folder conflict!"; | 373 logging::LOG_ERROR, |
| 374 FROM_HERE, |
| 375 "A file is left for CreateDirectory due to file-folder conflict!"); |
373 callback.Run(google_apis::HTTP_CONFLICT, std::string()); | 376 callback.Run(google_apis::HTTP_CONFLICT, std::string()); |
374 return; | 377 return; |
375 } | 378 } |
376 | 379 |
377 if (entry->title() == GetSyncRootDirectoryName()) | 380 if (entry->title() == GetSyncRootDirectoryName()) |
378 EnsureSyncRootIsNotInMyDrive(entry->resource_id()); | 381 EnsureSyncRootIsNotInMyDrive(entry->resource_id()); |
379 | 382 |
380 callback.Run(error, entry->resource_id()); | 383 callback.Run(error, entry->resource_id()); |
381 } | 384 } |
382 | 385 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 std::string APIUtil::GetRootResourceId() const { | 1061 std::string APIUtil::GetRootResourceId() const { |
1059 if (IsDriveAPIEnabled()) { | 1062 if (IsDriveAPIEnabled()) { |
1060 DCHECK(!root_resource_id_.empty()); | 1063 DCHECK(!root_resource_id_.empty()); |
1061 return root_resource_id_; | 1064 return root_resource_id_; |
1062 } | 1065 } |
1063 return drive_service_->GetRootResourceId(); | 1066 return drive_service_->GetRootResourceId(); |
1064 } | 1067 } |
1065 | 1068 |
1066 } // namespace drive | 1069 } // namespace drive |
1067 } // namespace sync_file_system | 1070 } // namespace sync_file_system |
OLD | NEW |