Chromium Code Reviews| 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_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 6 | 6 |
| 7 #include <string> | |
| 8 | |
| 7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 11 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 10 #include "chrome/browser/chromeos/drive/file_errors.h" | 12 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 13 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 12 #include "chrome/browser/chromeos/drive/file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 13 #include "chrome/browser/chromeos/file_manager/app_id.h" | 15 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 14 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 16 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 15 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 17 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 16 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 18 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 base::Passed(¶ms))); | 82 base::Passed(¶ms))); |
| 81 return; // Remaining work is done in ContinueGetSelectedFileInfo. | 83 return; // Remaining work is done in ContinueGetSelectedFileInfo. |
| 82 case NEED_LOCAL_PATH_FOR_SAVING: | 84 case NEED_LOCAL_PATH_FOR_SAVING: |
| 83 file_system->GetFileForSaving( | 85 file_system->GetFileForSaving( |
| 84 drive::util::ExtractDrivePath(file_path), | 86 drive::util::ExtractDrivePath(file_path), |
| 85 base::Bind(&ContinueGetSelectedFileInfo, | 87 base::Bind(&ContinueGetSelectedFileInfo, |
| 86 profile, | 88 profile, |
| 87 base::Passed(¶ms))); | 89 base::Passed(¶ms))); |
| 88 return; // Remaining work is done in ContinueGetSelectedFileInfo. | 90 return; // Remaining work is done in ContinueGetSelectedFileInfo. |
| 89 } | 91 } |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 params->callback.Run(params->selected_files); | 94 params->callback.Run(params->selected_files); |
| 93 } | 95 } |
| 94 | 96 |
| 95 // Part of GetSelectedFileInfo(). | 97 // Part of GetSelectedFileInfo(). |
| 96 void ContinueGetSelectedFileInfo(Profile* profile, | 98 void ContinueGetSelectedFileInfo(Profile* profile, |
| 97 scoped_ptr<GetSelectedFileInfoParams> params, | 99 scoped_ptr<GetSelectedFileInfoParams> params, |
| 98 drive::FileError error, | 100 drive::FileError error, |
| 99 const base::FilePath& local_file_path, | 101 const base::FilePath& local_file_path, |
| 100 scoped_ptr<drive::ResourceEntry> entry) { | 102 scoped_ptr<drive::ResourceEntry> entry) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 volume_metadata->volume_type = | 154 volume_metadata->volume_type = |
| 153 file_browser_private::VOLUME_TYPE_DOWNLOADS; | 155 file_browser_private::VOLUME_TYPE_DOWNLOADS; |
| 154 break; | 156 break; |
| 155 case VOLUME_TYPE_REMOVABLE_DISK_PARTITION: | 157 case VOLUME_TYPE_REMOVABLE_DISK_PARTITION: |
| 156 volume_metadata->volume_type = | 158 volume_metadata->volume_type = |
| 157 file_browser_private::VOLUME_TYPE_REMOVABLE; | 159 file_browser_private::VOLUME_TYPE_REMOVABLE; |
| 158 break; | 160 break; |
| 159 case VOLUME_TYPE_MOUNTED_ARCHIVE_FILE: | 161 case VOLUME_TYPE_MOUNTED_ARCHIVE_FILE: |
| 160 volume_metadata->volume_type = file_browser_private::VOLUME_TYPE_ARCHIVE; | 162 volume_metadata->volume_type = file_browser_private::VOLUME_TYPE_ARCHIVE; |
| 161 break; | 163 break; |
| 164 case VOLUME_TYPE_CLOUD_DEVICE: | |
| 165 volume_metadata->volume_type = | |
| 166 file_browser_private::VOLUME_TYPE_CLOUD_DEVICE; | |
|
gene
2014/01/09 08:13:53
add break; for consistancy
Noam Samuel
2014/01/09 20:23:24
Done.
| |
| 162 } | 167 } |
| 163 | 168 |
| 164 // Fill device_type iff the volume is removable partition. | 169 // Fill device_type iff the volume is removable partition. |
| 165 if (volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION) { | 170 if (volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION) { |
| 166 switch (volume_info.device_type) { | 171 switch (volume_info.device_type) { |
| 167 case chromeos::DEVICE_TYPE_UNKNOWN: | 172 case chromeos::DEVICE_TYPE_UNKNOWN: |
| 168 volume_metadata->device_type = | 173 volume_metadata->device_type = |
| 169 file_browser_private::DEVICE_TYPE_UNKNOWN; | 174 file_browser_private::DEVICE_TYPE_UNKNOWN; |
| 170 break; | 175 break; |
| 171 case chromeos::DEVICE_TYPE_USB: | 176 case chromeos::DEVICE_TYPE_USB: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 } | 250 } |
| 246 } | 251 } |
| 247 | 252 |
| 248 base::MessageLoop::current()->PostTask( | 253 base::MessageLoop::current()->PostTask( |
| 249 FROM_HERE, | 254 FROM_HERE, |
| 250 base::Bind(&GetSelectedFileInfoInternal, profile, base::Passed(¶ms))); | 255 base::Bind(&GetSelectedFileInfoInternal, profile, base::Passed(¶ms))); |
| 251 } | 256 } |
| 252 | 257 |
| 253 } // namespace util | 258 } // namespace util |
| 254 } // namespace file_manager | 259 } // namespace file_manager |
| OLD | NEW |