| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_manager/open_util.h" | 5 #include "chrome/browser/chromeos/file_manager/open_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // This is unfortunately necessary as file browser handlers operate on URLs. | 161 // This is unfortunately necessary as file browser handlers operate on URLs. |
| 162 GURL url; | 162 GURL url; |
| 163 if (!ConvertAbsoluteFilePathToFileSystemUrl(profile, file_path, | 163 if (!ConvertAbsoluteFilePathToFileSystemUrl(profile, file_path, |
| 164 kFileManagerAppId, &url)) { | 164 kFileManagerAppId, &url)) { |
| 165 callback.Run(platform_util::OPEN_FAILED_PATH_NOT_FOUND); | 165 callback.Run(platform_util::OPEN_FAILED_PATH_NOT_FOUND); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 | 168 |
| 169 GetMetadataForPath( | 169 GetMetadataForPath( |
| 170 GetFileSystemContextForExtensionId(profile, kFileManagerAppId), file_path, | 170 GetFileSystemContextForExtensionId(profile, kFileManagerAppId), file_path, |
| 171 storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY, |
| 171 base::Bind(&OpenItemWithMetadata, profile, file_path, url, expected_type, | 172 base::Bind(&OpenItemWithMetadata, profile, file_path, url, expected_type, |
| 172 callback)); | 173 callback)); |
| 173 } | 174 } |
| 174 | 175 |
| 175 void ShowItemInFolder(Profile* profile, | 176 void ShowItemInFolder(Profile* profile, |
| 176 const base::FilePath& file_path, | 177 const base::FilePath& file_path, |
| 177 const platform_util::OpenOperationCallback& callback) { | 178 const platform_util::OpenOperationCallback& callback) { |
| 178 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 179 | 180 |
| 180 GURL url; | 181 GURL url; |
| 181 if (!ConvertAbsoluteFilePathToFileSystemUrl(profile, file_path, | 182 if (!ConvertAbsoluteFilePathToFileSystemUrl(profile, file_path, |
| 182 kFileManagerAppId, &url)) { | 183 kFileManagerAppId, &url)) { |
| 183 callback.Run(platform_util::OPEN_FAILED_PATH_NOT_FOUND); | 184 callback.Run(platform_util::OPEN_FAILED_PATH_NOT_FOUND); |
| 184 return; | 185 return; |
| 185 } | 186 } |
| 186 | 187 |
| 187 // This action changes the selection so we do not reuse existing tabs. | 188 // This action changes the selection so we do not reuse existing tabs. |
| 188 OpenFileManagerWithInternalActionId(profile, url, "select"); | 189 OpenFileManagerWithInternalActionId(profile, url, "select"); |
| 189 callback.Run(platform_util::OPEN_SUCCEEDED); | 190 callback.Run(platform_util::OPEN_SUCCEEDED); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void DisableShellOperationsForTesting() { | 193 void DisableShellOperationsForTesting() { |
| 193 shell_operations_allowed = false; | 194 shell_operations_allowed = false; |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace util | 197 } // namespace util |
| 197 } // namespace file_manager | 198 } // namespace file_manager |
| OLD | NEW |