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/drive/drive_api_service.h" | 5 #include "chrome/browser/drive/drive_api_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/drive/drive_api_util.h" | 15 #include "chrome/browser/drive/drive_api_util.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "google_apis/drive/auth_service.h" | 17 #include "google_apis/drive/auth_service.h" |
18 #include "google_apis/drive/drive_api_parser.h" | 18 #include "google_apis/drive/drive_api_parser.h" |
19 #include "google_apis/drive/drive_api_requests.h" | 19 #include "google_apis/drive/drive_api_requests.h" |
20 #include "google_apis/drive/gdata_errorcode.h" | 20 #include "google_apis/drive/gdata_errorcode.h" |
21 #include "google_apis/drive/gdata_wapi_parser.h" | 21 #include "google_apis/drive/gdata_wapi_parser.h" |
22 #include "google_apis/drive/gdata_wapi_requests.h" | 22 #include "google_apis/drive/gdata_wapi_requests.h" |
23 #include "google_apis/drive/request_sender.h" | 23 #include "google_apis/drive/request_sender.h" |
24 #include "google_apis/google_api_keys.h" | 24 #include "google_apis/google_api_keys.h" |
25 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
26 | 26 |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 using google_apis::AboutResourceCallback; |
28 using google_apis::AppList; | 29 using google_apis::AppList; |
29 using google_apis::AppListCallback; | 30 using google_apis::AppListCallback; |
30 using google_apis::AuthStatusCallback; | 31 using google_apis::AuthStatusCallback; |
31 using google_apis::AuthorizeAppCallback; | 32 using google_apis::AuthorizeAppCallback; |
32 using google_apis::CancelCallback; | 33 using google_apis::CancelCallback; |
33 using google_apis::ChangeList; | 34 using google_apis::ChangeList; |
34 using google_apis::ChangeListCallback; | 35 using google_apis::ChangeListCallback; |
35 using google_apis::DownloadActionCallback; | 36 using google_apis::DownloadActionCallback; |
36 using google_apis::EntryActionCallback; | 37 using google_apis::EntryActionCallback; |
37 using google_apis::FileList; | 38 using google_apis::FileList; |
| 39 using google_apis::FileListCallback; |
38 using google_apis::FileResource; | 40 using google_apis::FileResource; |
39 using google_apis::GDATA_OTHER_ERROR; | 41 using google_apis::GDATA_OTHER_ERROR; |
40 using google_apis::GDATA_PARSE_ERROR; | 42 using google_apis::GDATA_PARSE_ERROR; |
41 using google_apis::GDataErrorCode; | 43 using google_apis::GDataErrorCode; |
42 using google_apis::AboutResourceCallback; | |
43 using google_apis::GetContentCallback; | 44 using google_apis::GetContentCallback; |
44 using google_apis::GetResourceEntryCallback; | 45 using google_apis::GetResourceEntryCallback; |
45 using google_apis::GetResourceEntryRequest; | 46 using google_apis::GetResourceEntryRequest; |
46 using google_apis::GetResourceListCallback; | |
47 using google_apis::GetShareUrlCallback; | 47 using google_apis::GetShareUrlCallback; |
48 using google_apis::HTTP_NOT_IMPLEMENTED; | 48 using google_apis::HTTP_NOT_IMPLEMENTED; |
49 using google_apis::HTTP_SUCCESS; | 49 using google_apis::HTTP_SUCCESS; |
50 using google_apis::InitiateUploadCallback; | 50 using google_apis::InitiateUploadCallback; |
51 using google_apis::Link; | 51 using google_apis::Link; |
52 using google_apis::ProgressCallback; | 52 using google_apis::ProgressCallback; |
53 using google_apis::RequestSender; | 53 using google_apis::RequestSender; |
54 using google_apis::ResourceEntry; | 54 using google_apis::ResourceEntry; |
55 using google_apis::ResourceList; | |
56 using google_apis::UploadRangeCallback; | 55 using google_apis::UploadRangeCallback; |
57 using google_apis::UploadRangeResponse; | 56 using google_apis::UploadRangeResponse; |
58 using google_apis::drive::AboutGetRequest; | 57 using google_apis::drive::AboutGetRequest; |
59 using google_apis::drive::AppsListRequest; | 58 using google_apis::drive::AppsListRequest; |
60 using google_apis::drive::ChangesListRequest; | 59 using google_apis::drive::ChangesListRequest; |
61 using google_apis::drive::ChangesListNextPageRequest; | 60 using google_apis::drive::ChangesListNextPageRequest; |
62 using google_apis::drive::ChildrenDeleteRequest; | 61 using google_apis::drive::ChildrenDeleteRequest; |
63 using google_apis::drive::ChildrenInsertRequest; | 62 using google_apis::drive::ChildrenInsertRequest; |
64 using google_apis::drive::DownloadFileRequest; | 63 using google_apis::drive::DownloadFileRequest; |
65 using google_apis::drive::FilesCopyRequest; | 64 using google_apis::drive::FilesCopyRequest; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," | 115 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," |
117 "parents/parentLink,alternateLink," | 116 "parents/parentLink,alternateLink," |
118 "modifiedDate,lastViewedByMeDate,shared),nextLink"; | 117 "modifiedDate,lastViewedByMeDate,shared),nextLink"; |
119 const char kChangeListFields[] = | 118 const char kChangeListFields[] = |
120 "kind,items(file(kind,id,title,createdDate,sharedWithMeDate," | 119 "kind,items(file(kind,id,title,createdDate,sharedWithMeDate," |
121 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," | 120 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," |
122 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," | 121 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," |
123 "parents/parentLink,alternateLink,modifiedDate,lastViewedByMeDate,shared)," | 122 "parents/parentLink,alternateLink,modifiedDate,lastViewedByMeDate,shared)," |
124 "deleted,id,fileId,modificationDate),nextLink,largestChangeId"; | 123 "deleted,id,fileId,modificationDate),nextLink,largestChangeId"; |
125 | 124 |
126 // Callback invoked when the parsing of resource list is completed, | |
127 // regardless whether it is succeeded or not. | |
128 void DidConvertToResourceListOnBlockingPool( | |
129 const GetResourceListCallback& callback, | |
130 scoped_ptr<ResourceList> resource_list) { | |
131 GDataErrorCode error = resource_list ? HTTP_SUCCESS : GDATA_PARSE_ERROR; | |
132 callback.Run(error, resource_list.Pass()); | |
133 } | |
134 | |
135 // Converts the FileResource value to ResourceEntry and runs |callback| on the | 125 // Converts the FileResource value to ResourceEntry and runs |callback| on the |
136 // UI thread. | 126 // UI thread. |
137 void ConvertFileEntryToResourceEntryAndRun( | 127 void ConvertFileEntryToResourceEntryAndRun( |
138 const GetResourceEntryCallback& callback, | 128 const GetResourceEntryCallback& callback, |
139 GDataErrorCode error, | 129 GDataErrorCode error, |
140 scoped_ptr<FileResource> value) { | 130 scoped_ptr<FileResource> value) { |
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
142 DCHECK(!callback.is_null()); | 132 DCHECK(!callback.is_null()); |
143 | 133 |
144 if (!value) { | 134 if (!value) { |
145 callback.Run(error, scoped_ptr<ResourceEntry>()); | 135 callback.Run(error, scoped_ptr<ResourceEntry>()); |
146 return; | 136 return; |
147 } | 137 } |
148 | 138 |
149 // Converting to ResourceEntry is cheap enough to do on UI thread. | 139 // Converting to ResourceEntry is cheap enough to do on UI thread. |
150 scoped_ptr<ResourceEntry> entry = | 140 scoped_ptr<ResourceEntry> entry = |
151 util::ConvertFileResourceToResourceEntry(*value); | 141 util::ConvertFileResourceToResourceEntry(*value); |
152 if (!entry) { | 142 if (!entry) { |
153 callback.Run(GDATA_PARSE_ERROR, scoped_ptr<ResourceEntry>()); | 143 callback.Run(GDATA_PARSE_ERROR, scoped_ptr<ResourceEntry>()); |
154 return; | 144 return; |
155 } | 145 } |
156 | 146 |
157 callback.Run(error, entry.Pass()); | 147 callback.Run(error, entry.Pass()); |
158 } | 148 } |
159 | 149 |
160 // Thin adapter of ConvertFileListToResourceList. | |
161 scoped_ptr<ResourceList> ConvertFileListToResourceList( | |
162 scoped_ptr<FileList> file_list) { | |
163 return util::ConvertFileListToResourceList(*file_list); | |
164 } | |
165 | |
166 // Converts the FileList value to ResourceList on blocking pool and runs | |
167 // |callback| on the UI thread. | |
168 void ConvertFileListToResourceListOnBlockingPoolAndRun( | |
169 scoped_refptr<base::TaskRunner> blocking_task_runner, | |
170 const GetResourceListCallback& callback, | |
171 GDataErrorCode error, | |
172 scoped_ptr<FileList> value) { | |
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
174 DCHECK(!callback.is_null()); | |
175 | |
176 if (!value) { | |
177 callback.Run(error, scoped_ptr<ResourceList>()); | |
178 return; | |
179 } | |
180 | |
181 // Convert the value on blocking pool. | |
182 base::PostTaskAndReplyWithResult( | |
183 blocking_task_runner.get(), | |
184 FROM_HERE, | |
185 base::Bind(&ConvertFileListToResourceList, base::Passed(&value)), | |
186 base::Bind(&DidConvertToResourceListOnBlockingPool, callback)); | |
187 } | |
188 | |
189 // Converts the FileResource value to ResourceEntry for upload range request, | 150 // Converts the FileResource value to ResourceEntry for upload range request, |
190 // and runs |callback| on the UI thread. | 151 // and runs |callback| on the UI thread. |
191 void ConvertFileResourceToResourceEntryForUploadRangeAndRun( | 152 void ConvertFileResourceToResourceEntryForUploadRangeAndRun( |
192 const UploadRangeCallback& callback, | 153 const UploadRangeCallback& callback, |
193 const UploadRangeResponse& response, | 154 const UploadRangeResponse& response, |
194 scoped_ptr<FileResource> value) { | 155 scoped_ptr<FileResource> value) { |
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
196 DCHECK(!callback.is_null()); | 157 DCHECK(!callback.is_null()); |
197 | 158 |
198 if (!value) { | 159 if (!value) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 237 } |
277 | 238 |
278 void DriveAPIService::Initialize(const std::string& account_id) { | 239 void DriveAPIService::Initialize(const std::string& account_id) { |
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
280 | 241 |
281 std::vector<std::string> scopes; | 242 std::vector<std::string> scopes; |
282 scopes.push_back(kDriveScope); | 243 scopes.push_back(kDriveScope); |
283 scopes.push_back(kDriveAppsReadonlyScope); | 244 scopes.push_back(kDriveAppsReadonlyScope); |
284 scopes.push_back(util::kDriveAppsScope); | 245 scopes.push_back(util::kDriveAppsScope); |
285 | 246 |
286 // GData WAPI token for GetShareUrl() and GetResourceListInDirectoryByWapi(). | 247 // GData WAPI token for GetShareUrl(). |
287 scopes.push_back(util::kDocsListScope); | 248 scopes.push_back(util::kDocsListScope); |
288 | 249 |
289 sender_.reset(new RequestSender( | 250 sender_.reset(new RequestSender( |
290 new google_apis::AuthService(oauth2_token_service_, | 251 new google_apis::AuthService(oauth2_token_service_, |
291 account_id, | 252 account_id, |
292 url_request_context_getter_.get(), | 253 url_request_context_getter_.get(), |
293 scopes), | 254 scopes), |
294 url_request_context_getter_.get(), | 255 url_request_context_getter_.get(), |
295 blocking_task_runner_.get(), | 256 blocking_task_runner_.get(), |
296 custom_user_agent_)); | 257 custom_user_agent_)); |
(...skipping 15 matching lines...) Expand all Loading... |
312 } | 273 } |
313 | 274 |
314 ResourceIdCanonicalizer DriveAPIService::GetResourceIdCanonicalizer() const { | 275 ResourceIdCanonicalizer DriveAPIService::GetResourceIdCanonicalizer() const { |
315 return base::Bind(&drive::util::CanonicalizeResourceId); | 276 return base::Bind(&drive::util::CanonicalizeResourceId); |
316 } | 277 } |
317 | 278 |
318 std::string DriveAPIService::GetRootResourceId() const { | 279 std::string DriveAPIService::GetRootResourceId() const { |
319 return kDriveApiRootDirectoryResourceId; | 280 return kDriveApiRootDirectoryResourceId; |
320 } | 281 } |
321 | 282 |
322 CancelCallback DriveAPIService::GetAllResourceList( | 283 CancelCallback DriveAPIService::GetAllFileList( |
323 const GetResourceListCallback& callback) { | 284 const FileListCallback& callback) { |
324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
325 DCHECK(!callback.is_null()); | 286 DCHECK(!callback.is_null()); |
326 | 287 |
327 FilesListRequest* request = new FilesListRequest( | 288 FilesListRequest* request = new FilesListRequest( |
328 sender_.get(), url_generator_, | 289 sender_.get(), url_generator_, callback); |
329 base::Bind(&ConvertFileListToResourceListOnBlockingPoolAndRun, | |
330 blocking_task_runner_, callback)); | |
331 request->set_max_results(kMaxNumFilesResourcePerRequest); | 290 request->set_max_results(kMaxNumFilesResourcePerRequest); |
332 request->set_q("trashed = false"); // Exclude trashed files. | 291 request->set_q("trashed = false"); // Exclude trashed files. |
333 request->set_fields(kFileListFields); | 292 request->set_fields(kFileListFields); |
334 return sender_->StartRequestWithRetry(request); | 293 return sender_->StartRequestWithRetry(request); |
335 } | 294 } |
336 | 295 |
337 CancelCallback DriveAPIService::GetResourceListInDirectory( | 296 CancelCallback DriveAPIService::GetFileListInDirectory( |
338 const std::string& directory_resource_id, | 297 const std::string& directory_resource_id, |
339 const GetResourceListCallback& callback) { | 298 const FileListCallback& callback) { |
340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
341 DCHECK(!directory_resource_id.empty()); | 300 DCHECK(!directory_resource_id.empty()); |
342 DCHECK(!callback.is_null()); | 301 DCHECK(!callback.is_null()); |
343 | 302 |
344 // Because children.list method on Drive API v2 returns only the list of | 303 // Because children.list method on Drive API v2 returns only the list of |
345 // children's references, but we need all file resource list. | 304 // children's references, but we need all file resource list. |
346 // So, here we use files.list method instead, with setting parents query. | 305 // So, here we use files.list method instead, with setting parents query. |
347 // After the migration from GData WAPI to Drive API v2, we should clean the | 306 // After the migration from GData WAPI to Drive API v2, we should clean the |
348 // code up by moving the responsibility to include "parents" in the query | 307 // code up by moving the responsibility to include "parents" in the query |
349 // to client side. | 308 // to client side. |
350 // We aren't interested in files in trash in this context, neither. | 309 // We aren't interested in files in trash in this context, neither. |
351 FilesListRequest* request = new FilesListRequest( | 310 FilesListRequest* request = new FilesListRequest( |
352 sender_.get(), url_generator_, | 311 sender_.get(), url_generator_, callback); |
353 base::Bind(&ConvertFileListToResourceListOnBlockingPoolAndRun, | |
354 blocking_task_runner_, callback)); | |
355 request->set_max_results(kMaxNumFilesResourcePerRequest); | 312 request->set_max_results(kMaxNumFilesResourcePerRequest); |
356 request->set_q(base::StringPrintf( | 313 request->set_q(base::StringPrintf( |
357 "'%s' in parents and trashed = false", | 314 "'%s' in parents and trashed = false", |
358 drive::util::EscapeQueryStringValue(directory_resource_id).c_str())); | 315 drive::util::EscapeQueryStringValue(directory_resource_id).c_str())); |
359 request->set_fields(kFileListFields); | 316 request->set_fields(kFileListFields); |
360 return sender_->StartRequestWithRetry(request); | 317 return sender_->StartRequestWithRetry(request); |
361 } | 318 } |
362 | 319 |
363 CancelCallback DriveAPIService::Search( | 320 CancelCallback DriveAPIService::Search( |
364 const std::string& search_query, | 321 const std::string& search_query, |
365 const GetResourceListCallback& callback) { | 322 const FileListCallback& callback) { |
366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
367 DCHECK(!search_query.empty()); | 324 DCHECK(!search_query.empty()); |
368 DCHECK(!callback.is_null()); | 325 DCHECK(!callback.is_null()); |
369 | 326 |
370 FilesListRequest* request = new FilesListRequest( | 327 FilesListRequest* request = new FilesListRequest( |
371 sender_.get(), url_generator_, | 328 sender_.get(), url_generator_, callback); |
372 base::Bind(&ConvertFileListToResourceListOnBlockingPoolAndRun, | |
373 blocking_task_runner_, callback)); | |
374 request->set_max_results(kMaxNumFilesResourcePerRequestForSearch); | 329 request->set_max_results(kMaxNumFilesResourcePerRequestForSearch); |
375 request->set_q(drive::util::TranslateQuery(search_query)); | 330 request->set_q(drive::util::TranslateQuery(search_query)); |
376 request->set_fields(kFileListFields); | 331 request->set_fields(kFileListFields); |
377 return sender_->StartRequestWithRetry(request); | 332 return sender_->StartRequestWithRetry(request); |
378 } | 333 } |
379 | 334 |
380 CancelCallback DriveAPIService::SearchByTitle( | 335 CancelCallback DriveAPIService::SearchByTitle( |
381 const std::string& title, | 336 const std::string& title, |
382 const std::string& directory_resource_id, | 337 const std::string& directory_resource_id, |
383 const GetResourceListCallback& callback) { | 338 const FileListCallback& callback) { |
384 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
385 DCHECK(!title.empty()); | 340 DCHECK(!title.empty()); |
386 DCHECK(!callback.is_null()); | 341 DCHECK(!callback.is_null()); |
387 | 342 |
388 std::string query; | 343 std::string query; |
389 base::StringAppendF(&query, "title = '%s'", | 344 base::StringAppendF(&query, "title = '%s'", |
390 drive::util::EscapeQueryStringValue(title).c_str()); | 345 drive::util::EscapeQueryStringValue(title).c_str()); |
391 if (!directory_resource_id.empty()) { | 346 if (!directory_resource_id.empty()) { |
392 base::StringAppendF( | 347 base::StringAppendF( |
393 &query, " and '%s' in parents", | 348 &query, " and '%s' in parents", |
394 drive::util::EscapeQueryStringValue(directory_resource_id).c_str()); | 349 drive::util::EscapeQueryStringValue(directory_resource_id).c_str()); |
395 } | 350 } |
396 query += " and trashed = false"; | 351 query += " and trashed = false"; |
397 | 352 |
398 FilesListRequest* request = new FilesListRequest( | 353 FilesListRequest* request = new FilesListRequest( |
399 sender_.get(), url_generator_, | 354 sender_.get(), url_generator_, callback); |
400 base::Bind(&ConvertFileListToResourceListOnBlockingPoolAndRun, | |
401 blocking_task_runner_, callback)); | |
402 request->set_max_results(kMaxNumFilesResourcePerRequest); | 355 request->set_max_results(kMaxNumFilesResourcePerRequest); |
403 request->set_q(query); | 356 request->set_q(query); |
404 request->set_fields(kFileListFields); | 357 request->set_fields(kFileListFields); |
405 return sender_->StartRequestWithRetry(request); | 358 return sender_->StartRequestWithRetry(request); |
406 } | 359 } |
407 | 360 |
408 CancelCallback DriveAPIService::GetChangeList( | 361 CancelCallback DriveAPIService::GetChangeList( |
409 int64 start_changestamp, | 362 int64 start_changestamp, |
410 const ChangeListCallback& callback) { | 363 const ChangeListCallback& callback) { |
411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 364 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 16 matching lines...) Expand all Loading... |
428 | 381 |
429 ChangesListNextPageRequest* request = new ChangesListNextPageRequest( | 382 ChangesListNextPageRequest* request = new ChangesListNextPageRequest( |
430 sender_.get(), callback); | 383 sender_.get(), callback); |
431 request->set_next_link(next_link); | 384 request->set_next_link(next_link); |
432 request->set_fields(kChangeListFields); | 385 request->set_fields(kChangeListFields); |
433 return sender_->StartRequestWithRetry(request); | 386 return sender_->StartRequestWithRetry(request); |
434 } | 387 } |
435 | 388 |
436 CancelCallback DriveAPIService::GetRemainingFileList( | 389 CancelCallback DriveAPIService::GetRemainingFileList( |
437 const GURL& next_link, | 390 const GURL& next_link, |
438 const GetResourceListCallback& callback) { | 391 const FileListCallback& callback) { |
439 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
440 DCHECK(!next_link.is_empty()); | 393 DCHECK(!next_link.is_empty()); |
441 DCHECK(!callback.is_null()); | 394 DCHECK(!callback.is_null()); |
442 | 395 |
443 FilesListNextPageRequest* request = new FilesListNextPageRequest( | 396 FilesListNextPageRequest* request = new FilesListNextPageRequest( |
444 sender_.get(), | 397 sender_.get(), callback); |
445 base::Bind(&ConvertFileListToResourceListOnBlockingPoolAndRun, | |
446 blocking_task_runner_, callback)); | |
447 request->set_next_link(next_link); | 398 request->set_next_link(next_link); |
448 request->set_fields(kFileListFields); | 399 request->set_fields(kFileListFields); |
449 return sender_->StartRequestWithRetry(request); | 400 return sender_->StartRequestWithRetry(request); |
450 } | 401 } |
451 | 402 |
452 CancelCallback DriveAPIService::GetResourceEntry( | 403 CancelCallback DriveAPIService::GetResourceEntry( |
453 const std::string& resource_id, | 404 const std::string& resource_id, |
454 const GetResourceEntryCallback& callback) { | 405 const GetResourceEntryCallback& callback) { |
455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
456 DCHECK(!callback.is_null()); | 407 DCHECK(!callback.is_null()); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 if (CanSendRequest()) { | 809 if (CanSendRequest()) { |
859 FOR_EACH_OBSERVER( | 810 FOR_EACH_OBSERVER( |
860 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 811 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
861 } else if (!HasRefreshToken()) { | 812 } else if (!HasRefreshToken()) { |
862 FOR_EACH_OBSERVER( | 813 FOR_EACH_OBSERVER( |
863 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 814 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
864 } | 815 } |
865 } | 816 } |
866 | 817 |
867 } // namespace drive | 818 } // namespace drive |
OLD | NEW |