OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc/fileapi/arc_file_system_instance_util.h" | 5 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_instance_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Otherwise, nullptr. | 31 // Otherwise, nullptr. |
32 mojom::FileSystemInstance* GetFileSystemInstance( | 32 mojom::FileSystemInstance* GetFileSystemInstance( |
33 const std::string& method_name_for_logging, | 33 const std::string& method_name_for_logging, |
34 uint32_t min_version) { | 34 uint32_t min_version) { |
35 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 35 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
36 auto* arc_service_manager = arc::ArcServiceManager::Get(); | 36 auto* arc_service_manager = arc::ArcServiceManager::Get(); |
37 if (!arc_service_manager) { | 37 if (!arc_service_manager) { |
38 LOG(ERROR) << "Failed to get ArcServiceManager."; | 38 LOG(ERROR) << "Failed to get ArcServiceManager."; |
39 return nullptr; | 39 return nullptr; |
40 } | 40 } |
| 41 // TODO(lhchavez): Stop calling GetInstanceForVersion() directly. |
41 return arc_service_manager->arc_bridge_service() | 42 return arc_service_manager->arc_bridge_service() |
42 ->file_system() | 43 ->file_system() |
43 ->GetInstanceForMethod(method_name_for_logging, min_version); | 44 ->GetInstanceForVersion(min_version, method_name_for_logging.c_str()); |
44 } | 45 } |
45 | 46 |
46 template <typename T> | 47 template <typename T> |
47 void PostToIOThread(const base::Callback<void(T)>& callback, T result) { | 48 void PostToIOThread(const base::Callback<void(T)>& callback, T result) { |
48 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 49 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
49 BrowserThread::PostTask( | 50 BrowserThread::PostTask( |
50 BrowserThread::IO, FROM_HERE, | 51 BrowserThread::IO, FROM_HERE, |
51 base::Bind(callback, base::Passed(std::move(result)))); | 52 base::Bind(callback, base::Passed(std::move(result)))); |
52 } | 53 } |
53 | 54 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 base::Bind( | 142 base::Bind( |
142 &GetChildDocumentsOnUIThread, authority, parent_document_id, | 143 &GetChildDocumentsOnUIThread, authority, parent_document_id, |
143 base::Bind( | 144 base::Bind( |
144 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, | 145 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, |
145 callback))); | 146 callback))); |
146 } | 147 } |
147 | 148 |
148 } // namespace file_system_instance_util | 149 } // namespace file_system_instance_util |
149 | 150 |
150 } // namespace arc | 151 } // namespace arc |
OLD | NEW |