| 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" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const int kMaxNumFilesResourcePerRequest = 300; | 98 const int kMaxNumFilesResourcePerRequest = 300; |
| 99 const int kMaxNumFilesResourcePerRequestForSearch = 100; | 99 const int kMaxNumFilesResourcePerRequestForSearch = 100; |
| 100 | 100 |
| 101 // For performance, we declare all fields we use. | 101 // For performance, we declare all fields we use. |
| 102 const char kAboutResourceFields[] = | 102 const char kAboutResourceFields[] = |
| 103 "kind,quotaBytesTotal,quotaBytesUsed,largestChangeId,rootFolderId"; | 103 "kind,quotaBytesTotal,quotaBytesUsed,largestChangeId,rootFolderId"; |
| 104 const char kFileResourceFields[] = | 104 const char kFileResourceFields[] = |
| 105 "kind,id,title,createdDate,sharedWithMeDate,mimeType," | 105 "kind,id,title,createdDate,sharedWithMeDate,mimeType," |
| 106 "md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," | 106 "md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," |
| 107 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," | 107 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," |
| 108 "parents/parentLink,alternateLink," | 108 "parents(id,parentLink),alternateLink," |
| 109 "modifiedDate,lastViewedByMeDate,shared"; | 109 "modifiedDate,lastViewedByMeDate,shared"; |
| 110 const char kFileResourceOpenWithLinksFields[] = | 110 const char kFileResourceOpenWithLinksFields[] = |
| 111 "kind,id,openWithLinks/*"; | 111 "kind,id,openWithLinks/*"; |
| 112 const char kFileListFields[] = | 112 const char kFileListFields[] = |
| 113 "kind,items(kind,id,title,createdDate,sharedWithMeDate," | 113 "kind,items(kind,id,title,createdDate,sharedWithMeDate," |
| 114 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," | 114 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," |
| 115 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," | 115 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," |
| 116 "parents/parentLink,alternateLink," | 116 "parents(id,parentLink),alternateLink," |
| 117 "modifiedDate,lastViewedByMeDate,shared),nextLink"; | 117 "modifiedDate,lastViewedByMeDate,shared),nextLink"; |
| 118 const char kChangeListFields[] = | 118 const char kChangeListFields[] = |
| 119 "kind,items(file(kind,id,title,createdDate,sharedWithMeDate," | 119 "kind,items(file(kind,id,title,createdDate,sharedWithMeDate," |
| 120 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," | 120 "mimeType,md5Checksum,fileSize,labels/trashed,imageMediaMetadata/width," |
| 121 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," | 121 "imageMediaMetadata/height,imageMediaMetadata/rotation,etag," |
| 122 "parents/parentLink,alternateLink,modifiedDate,lastViewedByMeDate,shared)," | 122 "parents(id,parentLink),alternateLink,modifiedDate," |
| 123 "deleted,id,fileId,modificationDate),nextLink,largestChangeId"; | 123 "lastViewedByMeDate,shared),deleted,id,fileId,modificationDate),nextLink," |
| 124 "largestChangeId"; |
| 124 | 125 |
| 125 // Converts the FileResource value to ResourceEntry and runs |callback| on the | 126 // Converts the FileResource value to ResourceEntry and runs |callback| on the |
| 126 // UI thread. | 127 // UI thread. |
| 127 void ConvertFileEntryToResourceEntryAndRun( | 128 void ConvertFileEntryToResourceEntryAndRun( |
| 128 const GetResourceEntryCallback& callback, | 129 const GetResourceEntryCallback& callback, |
| 129 GDataErrorCode error, | 130 GDataErrorCode error, |
| 130 scoped_ptr<FileResource> value) { | 131 scoped_ptr<FileResource> value) { |
| 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 132 DCHECK(!callback.is_null()); | 133 DCHECK(!callback.is_null()); |
| 133 | 134 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 if (CanSendRequest()) { | 810 if (CanSendRequest()) { |
| 810 FOR_EACH_OBSERVER( | 811 FOR_EACH_OBSERVER( |
| 811 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 812 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 812 } else if (!HasRefreshToken()) { | 813 } else if (!HasRefreshToken()) { |
| 813 FOR_EACH_OBSERVER( | 814 FOR_EACH_OBSERVER( |
| 814 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 815 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 815 } | 816 } |
| 816 } | 817 } |
| 817 | 818 |
| 818 } // namespace drive | 819 } // namespace drive |
| OLD | NEW |