OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/platform_util_internal.h" | 10 #include "chrome/browser/platform_util_internal.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 base::Bind(callback, OPEN_FAILED_PATH_NOT_FOUND)); | 28 base::Bind(callback, OPEN_FAILED_PATH_NOT_FOUND)); |
29 return; | 29 return; |
30 } | 30 } |
31 if (base::DirectoryExists(path) != (type == OPEN_FOLDER)) { | 31 if (base::DirectoryExists(path) != (type == OPEN_FOLDER)) { |
32 if (!callback.is_null()) | 32 if (!callback.is_null()) |
33 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 33 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
34 base::Bind(callback, OPEN_FAILED_INVALID_TYPE)); | 34 base::Bind(callback, OPEN_FAILED_INVALID_TYPE)); |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
| 38 #if !defined(OS_ANDROID) |
38 if (shell_operations_allowed) | 39 if (shell_operations_allowed) |
39 internal::PlatformOpenVerifiedItem(path, type); | 40 internal::PlatformOpenVerifiedItem(path, type); |
40 if (!callback.is_null()) | 41 if (!callback.is_null()) |
41 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 42 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
42 base::Bind(callback, OPEN_SUCCEEDED)); | 43 base::Bind(callback, OPEN_SUCCEEDED)); |
| 44 #else |
| 45 NOTIMPLEMENTED(); |
| 46 #endif |
43 } | 47 } |
44 | 48 |
45 } // namespace | 49 } // namespace |
46 | 50 |
47 namespace internal { | 51 namespace internal { |
48 | 52 |
49 void DisableShellOperationsForTesting() { | 53 void DisableShellOperationsForTesting() { |
50 shell_operations_allowed = false; | 54 shell_operations_allowed = false; |
51 } | 55 } |
52 | 56 |
53 } // namespace internal | 57 } // namespace internal |
54 | 58 |
55 void OpenItem(Profile* profile, | 59 void OpenItem(Profile* profile, |
56 const base::FilePath& full_path, | 60 const base::FilePath& full_path, |
57 OpenItemType item_type, | 61 OpenItemType item_type, |
58 const OpenOperationCallback& callback) { | 62 const OpenOperationCallback& callback) { |
59 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
60 BrowserThread::PostBlockingPoolTask( | 64 BrowserThread::PostBlockingPoolTask( |
61 FROM_HERE, base::Bind(&VerifyAndOpenItemOnBlockingThread, full_path, | 65 FROM_HERE, base::Bind(&VerifyAndOpenItemOnBlockingThread, full_path, |
62 item_type, callback)); | 66 item_type, callback)); |
63 } | 67 } |
64 | 68 |
65 } // namespace platform_util | 69 } // namespace platform_util |
OLD | NEW |