| 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 "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | |
| 10 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 9 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 12 #include "chrome/browser/chromeos/drive/logging.h" | 11 #include "chrome/browser/chromeos/drive/logging.h" |
| 13 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" | 12 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a
pi.h" | 13 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a
pi.h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" |
| 16 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 17 #include "chrome/browser/chromeos/extensions/file_manager/volume_manager.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/volume_manager.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chromeos/disks/disk_mount_manager.h" | 18 #include "chromeos/disks/disk_mount_manager.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 133 |
| 135 if (path.empty()) { | 134 if (path.empty()) { |
| 136 SendResponse(false); | 135 SendResponse(false); |
| 137 break; | 136 break; |
| 138 } | 137 } |
| 139 | 138 |
| 140 const base::FilePath::StringType display_name = path.BaseName().value(); | 139 const base::FilePath::StringType display_name = path.BaseName().value(); |
| 141 | 140 |
| 142 // Check if the source path is under Drive cache directory. | 141 // Check if the source path is under Drive cache directory. |
| 143 if (drive::util::IsUnderDriveMountPoint(path)) { | 142 if (drive::util::IsUnderDriveMountPoint(path)) { |
| 144 drive::DriveIntegrationService* integration_service = | |
| 145 drive::DriveIntegrationServiceFactory::GetForProfile(profile_); | |
| 146 drive::FileSystemInterface* file_system = | 143 drive::FileSystemInterface* file_system = |
| 147 integration_service ? integration_service->file_system() : NULL; | 144 drive::util::GetFileSystemByProfile(profile()); |
| 148 if (!file_system) { | 145 if (!file_system) { |
| 149 SendResponse(false); | 146 SendResponse(false); |
| 150 break; | 147 break; |
| 151 } | 148 } |
| 152 file_system->MarkCacheFileAsMounted( | 149 file_system->MarkCacheFileAsMounted( |
| 153 drive::util::ExtractDrivePath(path), | 150 drive::util::ExtractDrivePath(path), |
| 154 base::Bind(&FileBrowserPrivateAddMountFunction::OnMountedStateSet, | 151 base::Bind(&FileBrowserPrivateAddMountFunction::OnMountedStateSet, |
| 155 this, mount_type_str, display_name)); | 152 this, mount_type_str, display_name)); |
| 156 } else { | 153 } else { |
| 157 OnMountedStateSet(mount_type_str, display_name, | 154 OnMountedStateSet(mount_type_str, display_name, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 logging::LOG_INFO, | 267 logging::LOG_INFO, |
| 271 "%s[%d] succeeded. (results: '[%s]', %" PRIuS " mount points)", | 268 "%s[%d] succeeded. (results: '[%s]', %" PRIuS " mount points)", |
| 272 name().c_str(), request_id(), log_string.c_str(), result->GetSize()); | 269 name().c_str(), request_id(), log_string.c_str(), result->GetSize()); |
| 273 | 270 |
| 274 SetResult(result); | 271 SetResult(result); |
| 275 SendResponse(true); | 272 SendResponse(true); |
| 276 return true; | 273 return true; |
| 277 } | 274 } |
| 278 | 275 |
| 279 } // namespace extensions | 276 } // namespace extensions |
| OLD | NEW |