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_backend_v1/api_util.h" | 5 #include "chrome/browser/sync_file_system/drive_backend_v1/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/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/thread_task_runner_handle.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 #include "chrome/browser/drive/drive_api_service.h" | 19 #include "chrome/browser/drive/drive_api_service.h" |
19 #include "chrome/browser/drive/drive_api_util.h" | 20 #include "chrome/browser/drive/drive_api_util.h" |
20 #include "chrome/browser/drive/drive_uploader.h" | 21 #include "chrome/browser/drive/drive_uploader.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
23 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
24 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" | 25 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" |
25 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.
h" | 26 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.
h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 bool CreateTemporaryFile(const base::FilePath& dir_path, | 145 bool CreateTemporaryFile(const base::FilePath& dir_path, |
145 webkit_blob::ScopedFile* temp_file) { | 146 webkit_blob::ScopedFile* temp_file) { |
146 base::FilePath temp_file_path; | 147 base::FilePath temp_file_path; |
147 const bool success = base::CreateDirectory(dir_path) && | 148 const bool success = base::CreateDirectory(dir_path) && |
148 base::CreateTemporaryFileInDir(dir_path, &temp_file_path); | 149 base::CreateTemporaryFileInDir(dir_path, &temp_file_path); |
149 if (!success) | 150 if (!success) |
150 return success; | 151 return success; |
151 *temp_file = | 152 *temp_file = |
152 webkit_blob::ScopedFile(temp_file_path, | 153 webkit_blob::ScopedFile(temp_file_path, |
153 webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT, | 154 webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT, |
154 base::MessageLoopProxy::current().get()); | 155 base::ThreadTaskRunnerHandle::Get().get()); |
155 return success; | 156 return success; |
156 } | 157 } |
157 | 158 |
158 } // namespace | 159 } // namespace |
159 | 160 |
160 APIUtil::APIUtil(Profile* profile, | 161 APIUtil::APIUtil(Profile* profile, |
161 const base::FilePath& temp_dir_path) | 162 const base::FilePath& temp_dir_path) |
162 : oauth_service_(ProfileOAuth2TokenServiceFactory::GetForProfile(profile)), | 163 : oauth_service_(ProfileOAuth2TokenServiceFactory::GetForProfile(profile)), |
163 signin_manager_(SigninManagerFactory::GetForProfile(profile)), | 164 signin_manager_(SigninManagerFactory::GetForProfile(profile)), |
164 upload_next_key_(0), | 165 upload_next_key_(0), |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 } | 1143 } |
1143 | 1144 |
1144 std::string APIUtil::GetRootResourceId() const { | 1145 std::string APIUtil::GetRootResourceId() const { |
1145 if (IsDriveAPIDisabled()) | 1146 if (IsDriveAPIDisabled()) |
1146 return drive_service_->GetRootResourceId(); | 1147 return drive_service_->GetRootResourceId(); |
1147 return root_resource_id_; | 1148 return root_resource_id_; |
1148 } | 1149 } |
1149 | 1150 |
1150 } // namespace drive_backend | 1151 } // namespace drive_backend |
1151 } // namespace sync_file_system | 1152 } // namespace sync_file_system |
OLD | NEW |