Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 276313002: drive: Change FileCache::GetCacheEntry's return type to FileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/drive/sync_client_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chromeos/extensions/file_manager/private_api_drive.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 8 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
9 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 9 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
10 #include "chrome/browser/chromeos/file_manager/file_tasks.h" 10 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 } 313 }
314 } 314 }
315 315
316 file_system->GetCacheEntry( 316 file_system->GetCacheEntry(
317 file_path_, 317 file_path_,
318 base::Bind(&SingleDriveEntryPropertiesGetter::CacheStateReceived, 318 base::Bind(&SingleDriveEntryPropertiesGetter::CacheStateReceived,
319 GetWeakPtr())); 319 GetWeakPtr()));
320 } 320 }
321 321
322 void CacheStateReceived(bool /* success */, 322 void CacheStateReceived(drive::FileError error,
323 const drive::FileCacheEntry& cache_entry) { 323 const drive::FileCacheEntry& cache_entry) {
324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
325 325
326 // In case of an error (i.e. success is false), cache_entry.is_*() all 326 if (error == drive::FILE_ERROR_OK) {
327 // returns false. 327 properties_->is_pinned.reset(new bool(cache_entry.is_pinned()));
328 properties_->is_pinned.reset(new bool(cache_entry.is_pinned())); 328 properties_->is_present.reset(new bool(cache_entry.is_present()));
329 properties_->is_present.reset(new bool(cache_entry.is_present())); 329 } else if (error == drive::FILE_ERROR_NOT_FOUND) {
330 330 // NOT_FOUND is not an error, return OK instead.
331 CompleteGetFileProperties(drive::FILE_ERROR_OK); 331 error = drive::FILE_ERROR_OK;
332 properties_->is_pinned.reset(new bool(false));
333 properties_->is_present.reset(new bool(false));
334 }
335 CompleteGetFileProperties(error);
332 } 336 }
333 337
334 void CompleteGetFileProperties(drive::FileError error) { 338 void CompleteGetFileProperties(drive::FileError error) {
335 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
336 DCHECK(!callback_.is_null()); 340 DCHECK(!callback_.is_null());
337 callback_.Run(error); 341 callback_.Run(error);
338 342
339 delete this; 343 delete this;
340 } 344 }
341 }; // class SingleDriveEntryPropertiesGetter 345 }; // class SingleDriveEntryPropertiesGetter
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 this)); 895 this));
892 return true; 896 return true;
893 } 897 }
894 898
895 void FileBrowserPrivateRequestDriveShareFunction::OnAddPermission( 899 void FileBrowserPrivateRequestDriveShareFunction::OnAddPermission(
896 drive::FileError error) { 900 drive::FileError error) {
897 SendResponse(error == drive::FILE_ERROR_OK); 901 SendResponse(error == drive::FILE_ERROR_OK);
898 } 902 }
899 903
900 } // namespace extensions 904 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/sync_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698