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

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

Issue 1147813003: Files.app: Tell users that the remaining space is 0 bytes when Drive usage is over quota. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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_file_syste m.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste m.h"
6 6
7 #include <sys/statvfs.h> 7 #include <sys/statvfs.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 return true; 424 return true;
425 } 425 }
426 426
427 void FileManagerPrivateGetSizeStatsFunction::GetDriveAvailableSpaceCallback( 427 void FileManagerPrivateGetSizeStatsFunction::GetDriveAvailableSpaceCallback(
428 drive::FileError error, 428 drive::FileError error,
429 int64 bytes_total, 429 int64 bytes_total,
430 int64 bytes_used) { 430 int64 bytes_used) {
431 if (error == drive::FILE_ERROR_OK) { 431 if (error == drive::FILE_ERROR_OK) {
432 const uint64 bytes_total_unsigned = bytes_total; 432 const uint64 bytes_total_unsigned = bytes_total;
433 const uint64 bytes_remaining_unsigned = bytes_total - bytes_used; 433 // bytes_used can be larger than bytes_total (over quota).
434 const uint64 bytes_remaining_unsigned =
435 std::max(bytes_total - bytes_used, int64(0));
434 GetSizeStatsCallback(&bytes_total_unsigned, 436 GetSizeStatsCallback(&bytes_total_unsigned,
435 &bytes_remaining_unsigned); 437 &bytes_remaining_unsigned);
436 } else { 438 } else {
437 // If stats couldn't be gotten for drive, result should be left undefined. 439 // If stats couldn't be gotten for drive, result should be left undefined.
438 SendResponse(true); 440 SendResponse(true);
439 } 441 }
440 } 442 }
441 443
442 void FileManagerPrivateGetSizeStatsFunction::GetSizeStatsCallback( 444 void FileManagerPrivateGetSizeStatsFunction::GetSizeStatsCallback(
443 const uint64* total_size, 445 const uint64* total_size,
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 return RespondLater(); 898 return RespondLater();
897 } 899 }
898 900
899 void FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted( 901 void FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted(
900 drive::FileError result) { 902 drive::FileError result) {
901 Respond(result == drive::FILE_ERROR_OK ? NoArguments() 903 Respond(result == drive::FILE_ERROR_OK ? NoArguments()
902 : Error("Failed to set a tag.")); 904 : Error("Failed to set a tag."));
903 } 905 }
904 906
905 } // namespace extensions 907 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698