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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/chromeos/drive/drive.pb.h" | 8 #include "chrome/browser/chromeos/drive/drive.pb.h" |
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
10 #include "chrome/browser/chromeos/drive/file_errors.h" | 10 #include "chrome/browser/chromeos/drive/file_errors.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 drive::DriveIntegrationServiceFactory::GetForProfile(profile); | 63 drive::DriveIntegrationServiceFactory::GetForProfile(profile); |
64 // |integration_service| is NULL if Drive is disabled. | 64 // |integration_service| is NULL if Drive is disabled. |
65 if (!integration_service) { | 65 if (!integration_service) { |
66 ContinueGetSelectedFileInfo(profile, | 66 ContinueGetSelectedFileInfo(profile, |
67 params.Pass(), | 67 params.Pass(), |
68 drive::FILE_ERROR_FAILED, | 68 drive::FILE_ERROR_FAILED, |
69 base::FilePath(), | 69 base::FilePath(), |
70 scoped_ptr<drive::ResourceEntry>()); | 70 scoped_ptr<drive::ResourceEntry>()); |
71 return; | 71 return; |
72 } | 72 } |
73 // TODO(kinaba): crbug.com/140425 support FOR_SAVING | 73 if (params->local_path_option == NEED_LOCAL_PATH_FOR_OPENING) { |
74 DCHECK(params->local_path_option == NEED_LOCAL_PATH_FOR_OPENING); | 74 integration_service->file_system()->GetFileByPath( |
75 integration_service->file_system()->GetFileByPath( | 75 drive::util::ExtractDrivePath(file_path), |
76 drive::util::ExtractDrivePath(file_path), | 76 base::Bind(&ContinueGetSelectedFileInfo, |
77 base::Bind(&ContinueGetSelectedFileInfo, | 77 profile, |
78 profile, | 78 base::Passed(¶ms))); |
79 base::Passed(¶ms))); | 79 } else { |
hashimoto
2013/08/08 07:07:28
nit: Can't we have DCHECK_EQ(NEED_LOCAL_PATH_FOR_S
kinaba
2013/08/08 08:07:13
Done.
| |
80 integration_service->file_system()->GetFileByPathForSaving( | |
81 drive::util::ExtractDrivePath(file_path), | |
82 base::Bind(&ContinueGetSelectedFileInfo, | |
83 profile, | |
84 base::Passed(¶ms))); | |
85 } | |
80 return; | 86 return; |
81 } | 87 } |
82 } | 88 } |
83 params->callback.Run(params->selected_files); | 89 params->callback.Run(params->selected_files); |
84 } | 90 } |
85 | 91 |
86 // Part of GetSelectedFileInfo(). | 92 // Part of GetSelectedFileInfo(). |
87 void ContinueGetSelectedFileInfo(Profile* profile, | 93 void ContinueGetSelectedFileInfo(Profile* profile, |
88 scoped_ptr<GetSelectedFileInfoParams> params, | 94 scoped_ptr<GetSelectedFileInfoParams> params, |
89 drive::FileError error, | 95 drive::FileError error, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 | 187 |
182 BrowserThread::PostTask( | 188 BrowserThread::PostTask( |
183 BrowserThread::UI, FROM_HERE, | 189 BrowserThread::UI, FROM_HERE, |
184 base::Bind(&GetSelectedFileInfoInternal, | 190 base::Bind(&GetSelectedFileInfoInternal, |
185 profile, | 191 profile, |
186 base::Passed(¶ms))); | 192 base::Passed(¶ms))); |
187 } | 193 } |
188 | 194 |
189 } // namespace util | 195 } // namespace util |
190 } // namespace file_manager | 196 } // namespace file_manager |
OLD | NEW |