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_mount.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_mount.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 callback.Run(drive::FILE_ERROR_ACCESS_DENIED, base::FilePath()); | 41 callback.Run(drive::FILE_ERROR_ACCESS_DENIED, base::FilePath()); |
42 return; | 42 return; |
43 } | 43 } |
44 callback.Run(drive::FILE_ERROR_OK, path); | 44 callback.Run(drive::FILE_ERROR_OK, path); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 bool FileManagerPrivateAddMountFunction::RunAsync() { | 49 bool FileManagerPrivateAddMountFunction::RunAsync() { |
50 using file_manager_private::AddMount::Params; | 50 using file_manager_private::AddMount::Params; |
51 const scoped_ptr<Params> params(Params::Create(*args_)); | 51 const std::unique_ptr<Params> params(Params::Create(*args_)); |
52 EXTENSION_FUNCTION_VALIDATE(params); | 52 EXTENSION_FUNCTION_VALIDATE(params); |
53 | 53 |
54 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); | 54 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); |
55 if (logger) { | 55 if (logger) { |
56 logger->Log(logging::LOG_INFO, "%s[%d] called. (source: '%s')", name(), | 56 logger->Log(logging::LOG_INFO, "%s[%d] called. (source: '%s')", name(), |
57 request_id(), | 57 request_id(), |
58 params->source.empty() ? "(none)" : params->source.c_str()); | 58 params->source.empty() ? "(none)" : params->source.c_str()); |
59 } | 59 } |
60 set_log_on_completion(true); | 60 set_log_on_completion(true); |
61 | 61 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 path.BaseName(), drive::FILE_ERROR_OK, path); | 112 path.BaseName(), drive::FILE_ERROR_OK, path); |
113 } | 113 } |
114 } | 114 } |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 void FileManagerPrivateAddMountFunction::RunAfterGetDriveFile( | 118 void FileManagerPrivateAddMountFunction::RunAfterGetDriveFile( |
119 const base::FilePath& drive_path, | 119 const base::FilePath& drive_path, |
120 drive::FileError error, | 120 drive::FileError error, |
121 const base::FilePath& cache_path, | 121 const base::FilePath& cache_path, |
122 scoped_ptr<drive::ResourceEntry> entry) { | 122 std::unique_ptr<drive::ResourceEntry> entry) { |
123 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 123 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
124 | 124 |
125 if (error != drive::FILE_ERROR_OK) { | 125 if (error != drive::FILE_ERROR_OK) { |
126 SendResponse(false); | 126 SendResponse(false); |
127 return; | 127 return; |
128 } | 128 } |
129 | 129 |
130 drive::FileSystemInterface* const file_system = | 130 drive::FileSystemInterface* const file_system = |
131 drive::util::GetFileSystemByProfile(GetProfile()); | 131 drive::util::GetFileSystemByProfile(GetProfile()); |
132 if (!file_system) { | 132 if (!file_system) { |
(...skipping 28 matching lines...) Expand all Loading... |
161 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 161 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
162 disk_mount_manager->MountPath( | 162 disk_mount_manager->MountPath( |
163 file_path.AsUTF8Unsafe(), | 163 file_path.AsUTF8Unsafe(), |
164 base::FilePath(display_name.Extension()).AsUTF8Unsafe(), | 164 base::FilePath(display_name.Extension()).AsUTF8Unsafe(), |
165 display_name.AsUTF8Unsafe(), | 165 display_name.AsUTF8Unsafe(), |
166 chromeos::MOUNT_TYPE_ARCHIVE); | 166 chromeos::MOUNT_TYPE_ARCHIVE); |
167 } | 167 } |
168 | 168 |
169 bool FileManagerPrivateRemoveMountFunction::RunAsync() { | 169 bool FileManagerPrivateRemoveMountFunction::RunAsync() { |
170 using file_manager_private::RemoveMount::Params; | 170 using file_manager_private::RemoveMount::Params; |
171 const scoped_ptr<Params> params(Params::Create(*args_)); | 171 const std::unique_ptr<Params> params(Params::Create(*args_)); |
172 EXTENSION_FUNCTION_VALIDATE(params); | 172 EXTENSION_FUNCTION_VALIDATE(params); |
173 | 173 |
174 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); | 174 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); |
175 if (logger) { | 175 if (logger) { |
176 logger->Log(logging::LOG_INFO, "%s[%d] called. (volume_id: '%s')", name(), | 176 logger->Log(logging::LOG_INFO, "%s[%d] called. (volume_id: '%s')", name(), |
177 request_id(), params->volume_id.c_str()); | 177 request_id(), params->volume_id.c_str()); |
178 } | 178 } |
179 set_log_on_completion(true); | 179 set_log_on_completion(true); |
180 | 180 |
181 using file_manager::VolumeManager; | 181 using file_manager::VolumeManager; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 name(), request_id(), log_string.c_str(), result.size()); | 245 name(), request_id(), log_string.c_str(), result.size()); |
246 } | 246 } |
247 | 247 |
248 results_ = | 248 results_ = |
249 file_manager_private::GetVolumeMetadataList::Results::Create(result); | 249 file_manager_private::GetVolumeMetadataList::Results::Create(result); |
250 SendResponse(true); | 250 SendResponse(true); |
251 return true; | 251 return true; |
252 } | 252 } |
253 | 253 |
254 } // namespace extensions | 254 } // namespace extensions |
OLD | NEW |