Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/component_updater/cros_component_installer.cc

Issue 2744453003: Mount image upon component installed (Closed)
Patch Set: addressing comments from hashimoto Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
23 const std::string& result) {
24 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
25 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
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(const std::string& name,
45 chromeos::DBusMethodCallStatus call_status,
23 bool result) { 46 bool result) {
24 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 47 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
25 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { 48 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
26 DVLOG(1) << "Call to imageloader service failed."; 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(),
43 base::Bind(&LogRegistrationResult)); 67 base::Bind(&LogRegistrationResult, name));
44 } else { 68 } else {
45 DVLOG(1) << "Failed to get ImageLoaderClient object."; 69 DVLOG(1) << "Failed to get ImageLoaderClient object.";
46 } 70 }
47 } 71 }
48 ComponentConfig::ComponentConfig(const std::string& name, 72 ComponentConfig::ComponentConfig(const std::string& name,
49 const std::string& dir, 73 const std::string& dir,
50 const std::string& sha2hashstr) 74 const std::string& sha2hashstr)
51 : name(name), dir(dir), sha2hashstr(sha2hashstr) {} 75 : name(name), dir(dir), sha2hashstr(sha2hashstr) {}
52 ComponentConfig::~ComponentConfig() {} 76 ComponentConfig::~ComponentConfig() {}
53 77
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698