| 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" |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/drive/file_system_util.h" | 13 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 13 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 14 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 15 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 16 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/extensions/api/file_manager_private.h" | 18 #include "chrome/common/extensions/api/file_manager_private.h" |
| 18 #include "chromeos/disks/disk_mount_manager.h" | 19 #include "chromeos/disks/disk_mount_manager.h" |
| 19 #include "components/drive/chromeos/file_system_interface.h" | 20 #include "components/drive/chromeos/file_system_interface.h" |
| 20 #include "components/drive/event_logger.h" | 21 #include "components/drive/event_logger.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 drive::FileError error, | 148 drive::FileError error, |
| 148 const base::FilePath& file_path) { | 149 const base::FilePath& file_path) { |
| 149 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 150 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 150 | 151 |
| 151 if (error != drive::FILE_ERROR_OK) { | 152 if (error != drive::FILE_ERROR_OK) { |
| 152 SendResponse(false); | 153 SendResponse(false); |
| 153 return; | 154 return; |
| 154 } | 155 } |
| 155 | 156 |
| 156 // Pass back the actual source path of the mount point. | 157 // Pass back the actual source path of the mount point. |
| 157 SetResult(new base::StringValue(file_path.AsUTF8Unsafe())); | 158 SetResult(base::MakeUnique<base::StringValue>(file_path.AsUTF8Unsafe())); |
| 158 SendResponse(true); | 159 SendResponse(true); |
| 159 | 160 |
| 160 // MountPath() takes a std::string. | 161 // MountPath() takes a std::string. |
| 161 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 162 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
| 162 disk_mount_manager->MountPath( | 163 disk_mount_manager->MountPath( |
| 163 file_path.AsUTF8Unsafe(), | 164 file_path.AsUTF8Unsafe(), |
| 164 base::FilePath(display_name.Extension()).AsUTF8Unsafe(), | 165 base::FilePath(display_name.Extension()).AsUTF8Unsafe(), |
| 165 display_name.AsUTF8Unsafe(), | 166 display_name.AsUTF8Unsafe(), |
| 166 chromeos::MOUNT_TYPE_ARCHIVE); | 167 chromeos::MOUNT_TYPE_ARCHIVE); |
| 167 } | 168 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 name(), request_id(), log_string.c_str(), result.size()); | 246 name(), request_id(), log_string.c_str(), result.size()); |
| 246 } | 247 } |
| 247 | 248 |
| 248 results_ = | 249 results_ = |
| 249 file_manager_private::GetVolumeMetadataList::Results::Create(result); | 250 file_manager_private::GetVolumeMetadataList::Results::Create(result); |
| 250 SendResponse(true); | 251 SendResponse(true); |
| 251 return true; | 252 return true; |
| 252 } | 253 } |
| 253 | 254 |
| 254 } // namespace extensions | 255 } // namespace extensions |
| OLD | NEW |