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> |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "chrome/browser/google_apis/drive_api_parser.h" | 21 #include "chrome/browser/google_apis/drive_api_parser.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
25 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util. h" | 25 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util. h" |
26 #include "chrome/browser/sync_file_system/logger.h" | 26 #include "chrome/browser/sync_file_system/logger.h" |
27 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 27 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
28 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "extensions/common/constants.h" | 30 #include "extensions/common/constants.h" |
31 #include "net/base/mime_util.h" | 31 #include "net/base/mime_util.h" |
mmenke
2013/11/07 17:02:36
Again, the include.
hashimoto
2013/11/08 04:08:17
Added explicit one.
| |
32 | 32 |
33 namespace sync_file_system { | 33 namespace sync_file_system { |
34 namespace drive_backend { | 34 namespace drive_backend { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 enum ParentType { | 38 enum ParentType { |
39 PARENT_TYPE_ROOT_OR_EMPTY, | 39 PARENT_TYPE_ROOT_OR_EMPTY, |
40 PARENT_TYPE_DIRECTORY, | 40 PARENT_TYPE_DIRECTORY, |
41 }; | 41 }; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 GURL(google_apis::GDataWapiUrlGenerator:: | 164 GURL(google_apis::GDataWapiUrlGenerator:: |
165 kBaseDownloadUrlForProduction)), | 165 kBaseDownloadUrlForProduction)), |
166 drive_api_url_generator_( | 166 drive_api_url_generator_( |
167 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), | 167 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), |
168 GURL(google_apis::DriveApiUrlGenerator:: | 168 GURL(google_apis::DriveApiUrlGenerator:: |
169 kBaseDownloadUrlForProduction)), | 169 kBaseDownloadUrlForProduction)), |
170 upload_next_key_(0), | 170 upload_next_key_(0), |
171 temp_dir_path_(temp_dir_path) { | 171 temp_dir_path_(temp_dir_path) { |
172 ProfileOAuth2TokenService* oauth_service = | 172 ProfileOAuth2TokenService* oauth_service = |
173 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 173 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
174 base::SequencedWorkerPool* blocking_pool = | |
175 content::BrowserThread::GetBlockingPool(); | |
176 scoped_refptr<base::SequencedTaskRunner> task_runner( | |
177 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken())); | |
174 if (IsDriveAPIDisabled()) { | 178 if (IsDriveAPIDisabled()) { |
175 drive_service_.reset(new drive::GDataWapiService( | 179 drive_service_.reset(new drive::GDataWapiService( |
176 oauth_service, | 180 oauth_service, |
177 profile->GetRequestContext(), | 181 profile->GetRequestContext(), |
178 content::BrowserThread::GetBlockingPool(), | 182 task_runner.get(), |
179 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | 183 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), |
180 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), | 184 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), |
181 std::string() /* custom_user_agent */)); | 185 std::string() /* custom_user_agent */)); |
182 } else { | 186 } else { |
183 drive_service_.reset(new drive::DriveAPIService( | 187 drive_service_.reset(new drive::DriveAPIService( |
184 oauth_service, | 188 oauth_service, |
185 profile->GetRequestContext(), | 189 profile->GetRequestContext(), |
186 content::BrowserThread::GetBlockingPool(), | 190 task_runner.get(), |
187 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), | 191 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), |
188 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), | 192 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), |
189 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | 193 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), |
190 std::string() /* custom_user_agent */)); | 194 std::string() /* custom_user_agent */)); |
191 } | 195 } |
192 | 196 |
193 drive_service_->Initialize(oauth_service->GetPrimaryAccountId()); | 197 drive_service_->Initialize(oauth_service->GetPrimaryAccountId()); |
194 drive_service_->AddObserver(this); | 198 drive_service_->AddObserver(this); |
195 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 199 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
196 | 200 |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 } | 1144 } |
1141 | 1145 |
1142 std::string APIUtil::GetRootResourceId() const { | 1146 std::string APIUtil::GetRootResourceId() const { |
1143 if (IsDriveAPIDisabled()) | 1147 if (IsDriveAPIDisabled()) |
1144 return drive_service_->GetRootResourceId(); | 1148 return drive_service_->GetRootResourceId(); |
1145 return root_resource_id_; | 1149 return root_resource_id_; |
1146 } | 1150 } |
1147 | 1151 |
1148 } // namespace drive_backend | 1152 } // namespace drive_backend |
1149 } // namespace sync_file_system | 1153 } // namespace sync_file_system |
OLD | NEW |