OLD | NEW |
---|---|
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 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_util.h" | |
14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/posix/eintr_wrapper.h" | 17 #include "base/posix/eintr_wrapper.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
20 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
21 #include "base/task_runner_util.h" | 22 #include "base/task_runner_util.h" |
22 #include "base/threading/sequenced_worker_pool.h" | 23 #include "base/threading/sequenced_worker_pool.h" |
23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 this)); | 949 this)); |
949 return RespondLater(); | 950 return RespondLater(); |
950 } | 951 } |
951 | 952 |
952 void FileManagerPrivateInternalSetEntryTagFunction::OnSetEntryPropertyCompleted( | 953 void FileManagerPrivateInternalSetEntryTagFunction::OnSetEntryPropertyCompleted( |
953 drive::FileError result) { | 954 drive::FileError result) { |
954 Respond(result == drive::FILE_ERROR_OK ? NoArguments() | 955 Respond(result == drive::FILE_ERROR_OK ? NoArguments() |
955 : Error("Failed to set a tag.")); | 956 : Error("Failed to set a tag.")); |
956 } | 957 } |
957 | 958 |
959 bool FileManagerPrivateInternalGetDirectorySizeFunction::RunAsync() { | |
960 using extensions::api::file_manager_private_internal::GetDirectorySize:: | |
961 Params; | |
962 const std::unique_ptr<Params> params(Params::Create(*args_)); | |
963 EXTENSION_FUNCTION_VALIDATE(params); | |
964 | |
965 if (params->url.empty()) { | |
966 SetError("File URL must be provided"); | |
967 return false; | |
968 } | |
969 | |
970 const base::FilePath root_path = file_manager::util::GetLocalPathFromURL( | |
971 render_frame_host(), GetProfile(), GURL(params->url)); | |
972 | |
973 if (root_path.empty()) | |
974 return false; | |
975 | |
976 base::PostTaskAndReplyWithResult( | |
977 BrowserThread::GetBlockingPool(), FROM_HERE, | |
978 base::Bind(&base::ComputeDirectorySize, | |
979 root_path), | |
980 base::Bind(&FileManagerPrivateInternalGetDirectorySizeFunction:: | |
981 OnDirectorySizeRetrieved, this)); | |
fukino
2016/08/30 06:55:49
This line's indent level looks incorrect. Could yo
harukam
2016/08/30 07:35:38
Thanks! Done.
| |
982 return true; | |
983 } | |
984 | |
985 void FileManagerPrivateInternalGetDirectorySizeFunction:: | |
986 OnDirectorySizeRetrieved(int64_t size) { | |
987 SetResult( | |
988 base::MakeUnique<base::FundamentalValue>(static_cast<double>(size))); | |
989 SendResponse(true); | |
990 } | |
991 | |
958 } // namespace extensions | 992 } // namespace extensions |
OLD | NEW |