OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/component_updater/cros_component_installer.h" | 5 #include "chrome/browser/component_updater/cros_component_installer.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/component_updater/component_installer_errors.h" | 7 #include "chrome/browser/component_updater/component_installer_errors.h" |
8 #include "components/component_updater/component_updater_paths.h" | 8 #include "components/component_updater/component_updater_paths.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
11 #if defined(OS_CHROMEOS) | 11 #if defined(OS_CHROMEOS) |
12 #include "chromeos/dbus/dbus_method_call_status.h" | 12 #include "chromeos/dbus/dbus_method_call_status.h" |
13 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
14 #include "chromeos/dbus/image_loader_client.h" | 14 #include "chromeos/dbus/image_loader_client.h" |
15 #endif // defined(OS_CHROMEOS) | 15 #endif // defined(OS_CHROMEOS) |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace component_updater { | 19 namespace component_updater { |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 void LogRegistrationResult(chromeos::DBusMethodCallStatus call_status, | 22 void LogLoadResult(chromeos::DBusMethodCallStatus call_status, |
hashimoto
2017/03/10 04:27:22
Does this code compile?
Seems this callback lacks
xiaochu
2017/03/10 16:49:00
it is a StringDBusMethodCallback type. And a new i
| |
23 bool result) { | 23 const std::string& result) { |
24 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 24 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
25 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { | 25 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { |
26 DVLOG(1) << "Call to imageloader service failed."; | 26 DVLOG(1) << "Call to imageloader service failed."; |
27 return; | |
28 } | |
29 if (result.empty()) { | |
30 DVLOG(1) << "Component load failed"; | |
31 return; | |
32 } | |
33 } | |
34 void ImageLoaderLoad(const std::string& name) { | |
35 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
36 chromeos::ImageLoaderClient* loader = | |
37 chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); | |
38 if (loader) { | |
39 loader->LoadComponent(name, base::Bind(&LogLoadResult)); | |
40 } else { | |
41 DVLOG(1) << "Failed to get ImageLoaderClient object."; | |
42 } | |
43 } | |
44 void LogRegistrationResult(chromeos::DBusMethodCallStatus call_status, | |
45 bool result, | |
46 const std::string& name) { | |
47 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
48 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { | |
49 DVLOG(1) << "Call to imageloader service failed."; | |
27 return; | 50 return; |
28 } | 51 } |
29 if (!result) { | 52 if (!result) { |
30 DVLOG(1) << "Component registration failed"; | 53 DVLOG(1) << "Component registration failed"; |
31 return; | 54 return; |
32 } | 55 } |
56 ImageLoaderLoad(name); | |
33 } | 57 } |
34 void ImageLoaderRegistration(const std::string& version, | 58 void ImageLoaderRegistration(const std::string& version, |
35 const base::FilePath& install_dir, | 59 const base::FilePath& install_dir, |
36 const std::string& name) { | 60 const std::string& name) { |
37 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
38 chromeos::ImageLoaderClient* loader = | 62 chromeos::ImageLoaderClient* loader = |
39 chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); | 63 chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); |
40 | 64 |
41 if (loader) { | 65 if (loader) { |
42 loader->RegisterComponent(name, version, install_dir.value(), | 66 loader->RegisterComponent(name, version, install_dir.value(), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 bool RegisterCrOSComponent(ComponentUpdateService* cus, | 183 bool RegisterCrOSComponent(ComponentUpdateService* cus, |
160 const std::string& name) { | 184 const std::string& name) { |
161 #if defined(OS_CHROMEOS) | 185 #if defined(OS_CHROMEOS) |
162 return RegisterCrOSComponentInternal(cus, name); | 186 return RegisterCrOSComponentInternal(cus, name); |
163 #else | 187 #else |
164 return false; | 188 return false; |
165 #endif // defined(OS_CHROMEOS) | 189 #endif // defined(OS_CHROMEOS) |
166 } | 190 } |
167 | 191 |
168 } // namespace component_updater | 192 } // namespace component_updater |
OLD | NEW |