| 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/chromeos/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <sys/statvfs.h> | 8 #include <sys/statvfs.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <utime.h> | 10 #include <utime.h> |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 // Retrieves total and remaining available size on |mount_path|. | 287 // Retrieves total and remaining available size on |mount_path|. |
| 288 void GetSizeStatsOnBlockingPool(const std::string& mount_path, | 288 void GetSizeStatsOnBlockingPool(const std::string& mount_path, |
| 289 size_t* total_size_kb, | 289 size_t* total_size_kb, |
| 290 size_t* remaining_size_kb) { | 290 size_t* remaining_size_kb) { |
| 291 uint64_t total_size_in_bytes = 0; | 291 uint64_t total_size_in_bytes = 0; |
| 292 uint64_t remaining_size_in_bytes = 0; | 292 uint64_t remaining_size_in_bytes = 0; |
| 293 | 293 |
| 294 struct statvfs stat = {}; // Zero-clear | 294 struct statvfs stat = {}; // Zero-clear |
| 295 if (statvfs(mount_path.c_str(), &stat) == 0) { | 295 if (HANDLE_EINTR(statvfs(mount_path.c_str(), &stat)) == 0) { |
| 296 total_size_in_bytes = | 296 total_size_in_bytes = |
| 297 static_cast<uint64_t>(stat.f_blocks) * stat.f_frsize; | 297 static_cast<uint64_t>(stat.f_blocks) * stat.f_frsize; |
| 298 remaining_size_in_bytes = | 298 remaining_size_in_bytes = |
| 299 static_cast<uint64_t>(stat.f_bfree) * stat.f_frsize; | 299 static_cast<uint64_t>(stat.f_bfree) * stat.f_frsize; |
| 300 } | 300 } |
| 301 *total_size_kb = static_cast<size_t>(total_size_in_bytes / 1024); | 301 *total_size_kb = static_cast<size_t>(total_size_in_bytes / 1024); |
| 302 *remaining_size_kb = static_cast<size_t>(remaining_size_in_bytes / 1024); | 302 *remaining_size_kb = static_cast<size_t>(remaining_size_in_bytes / 1024); |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Given a |url|, return the virtual FilePath associated with it. If the file | 305 // Given a |url|, return the virtual FilePath associated with it. If the file |
| (...skipping 3031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3337 OpenNewWindowFunction::OpenNewWindowFunction() {} | 3337 OpenNewWindowFunction::OpenNewWindowFunction() {} |
| 3338 | 3338 |
| 3339 OpenNewWindowFunction::~OpenNewWindowFunction() {} | 3339 OpenNewWindowFunction::~OpenNewWindowFunction() {} |
| 3340 | 3340 |
| 3341 bool OpenNewWindowFunction::RunImpl() { | 3341 bool OpenNewWindowFunction::RunImpl() { |
| 3342 std::string url; | 3342 std::string url; |
| 3343 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); | 3343 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); |
| 3344 file_manager_util::OpenNewWindow(profile_, GURL(url)); | 3344 file_manager_util::OpenNewWindow(profile_, GURL(url)); |
| 3345 return true; | 3345 return true; |
| 3346 } | 3346 } |
| OLD | NEW |