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 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 constexpr uint32_t kGetFileSizeVersion = 1; | 25 constexpr uint32_t kGetFileSizeVersion = 1; |
26 constexpr uint32_t kOpenFileToReadVersion = 1; | 26 constexpr uint32_t kOpenFileToReadVersion = 1; |
27 constexpr uint32_t kGetDocumentVersion = 2; | 27 constexpr uint32_t kGetDocumentVersion = 2; |
28 constexpr uint32_t kGetChildDocumentsVersion = 2; | 28 constexpr uint32_t kGetChildDocumentsVersion = 2; |
29 | 29 |
30 // Returns FileSystemInstance for the given |min_version|, if found. | 30 // Returns FileSystemInstance for the given |min_version|, if found. |
31 // Otherwise, nullptr. | 31 // Otherwise, nullptr. |
32 mojom::FileSystemInstance* GetFileSystemInstance( | 32 mojom::FileSystemInstance* GetFileSystemInstance( |
Yusuke Sato
2017/01/04 19:59:12
Can you define ARC_GET_MIN_VERSION_FOR_METHOD macr
Luis Héctor Chávez
2017/01/04 20:38:56
Long term we should probably stop using the GetIns
| |
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 return arc_service_manager->arc_bridge_service() | 41 return arc_service_manager->arc_bridge_service() |
42 ->file_system() | 42 ->file_system() |
43 ->GetInstanceForMethod(method_name_for_logging, min_version); | 43 ->GetInstanceForVersion(min_version, method_name_for_logging.c_str()); |
44 } | 44 } |
45 | 45 |
46 template <typename T> | 46 template <typename T> |
47 void PostToIOThread(const base::Callback<void(T)>& callback, T result) { | 47 void PostToIOThread(const base::Callback<void(T)>& callback, T result) { |
48 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 48 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
49 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
50 BrowserThread::IO, FROM_HERE, | 50 BrowserThread::IO, FROM_HERE, |
51 base::Bind(callback, base::Passed(std::move(result)))); | 51 base::Bind(callback, base::Passed(std::move(result)))); |
52 } | 52 } |
53 | 53 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 base::Bind( | 141 base::Bind( |
142 &GetChildDocumentsOnUIThread, authority, parent_document_id, | 142 &GetChildDocumentsOnUIThread, authority, parent_document_id, |
143 base::Bind( | 143 base::Bind( |
144 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, | 144 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, |
145 callback))); | 145 callback))); |
146 } | 146 } |
147 | 147 |
148 } // namespace file_system_instance_util | 148 } // namespace file_system_instance_util |
149 | 149 |
150 } // namespace arc | 150 } // namespace arc |
OLD | NEW |