OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/recovery_component_installer.h" | 5 #include "chrome/browser/component_updater/recovery_component_installer.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 explicit RecoveryComponentInstaller(const Version& version, | 49 explicit RecoveryComponentInstaller(const Version& version, |
50 PrefService* prefs); | 50 PrefService* prefs); |
51 | 51 |
52 virtual ~RecoveryComponentInstaller() {} | 52 virtual ~RecoveryComponentInstaller() {} |
53 | 53 |
54 virtual void OnUpdateError(int error) OVERRIDE; | 54 virtual void OnUpdateError(int error) OVERRIDE; |
55 | 55 |
56 virtual bool Install(const base::DictionaryValue& manifest, | 56 virtual bool Install(const base::DictionaryValue& manifest, |
57 const base::FilePath& unpack_path) OVERRIDE; | 57 const base::FilePath& unpack_path) OVERRIDE; |
58 | 58 |
| 59 virtual bool GetInstalledFile(const std::string& file, |
| 60 base::FilePath* installed_file) OVERRIDE; |
| 61 |
59 private: | 62 private: |
60 Version current_version_; | 63 Version current_version_; |
61 PrefService* prefs_; | 64 PrefService* prefs_; |
62 }; | 65 }; |
63 | 66 |
64 void RecoveryRegisterHelper(ComponentUpdateService* cus, | 67 void RecoveryRegisterHelper(ComponentUpdateService* cus, |
65 PrefService* prefs) { | 68 PrefService* prefs) { |
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
67 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); | 70 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); |
68 if (!version.IsValid()) { | 71 if (!version.IsValid()) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 cmdline.AppendSwitchASCII("version", current_version_.GetString()); | 126 cmdline.AppendSwitchASCII("version", current_version_.GetString()); |
124 } | 127 } |
125 current_version_ = version; | 128 current_version_ = version; |
126 if (prefs_) { | 129 if (prefs_) { |
127 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
128 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); | 131 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); |
129 } | 132 } |
130 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); | 133 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); |
131 } | 134 } |
132 | 135 |
| 136 bool RecoveryComponentInstaller::GetInstalledFile( |
| 137 const std::string& file, base::FilePath* installed_file) { |
| 138 return false; |
| 139 } |
| 140 |
133 void RegisterRecoveryComponent(ComponentUpdateService* cus, | 141 void RegisterRecoveryComponent(ComponentUpdateService* cus, |
134 PrefService* prefs) { | 142 PrefService* prefs) { |
135 #if !defined(OS_CHROMEOS) | 143 #if !defined(OS_CHROMEOS) |
136 // We delay execute the registration because we are not required in | 144 // We delay execute the registration because we are not required in |
137 // the critical path during browser startup. | 145 // the critical path during browser startup. |
138 BrowserThread::PostDelayedTask( | 146 BrowserThread::PostDelayedTask( |
139 BrowserThread::UI, | 147 BrowserThread::UI, |
140 FROM_HERE, | 148 FROM_HERE, |
141 base::Bind(&RecoveryRegisterHelper, cus, prefs), | 149 base::Bind(&RecoveryRegisterHelper, cus, prefs), |
142 base::TimeDelta::FromSeconds(6)); | 150 base::TimeDelta::FromSeconds(6)); |
143 #endif | 151 #endif |
144 } | 152 } |
145 | 153 |
146 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { | 154 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { |
147 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); | 155 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); |
148 } | 156 } |
OLD | NEW |