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/ui/webui/help/version_updater_chromeos.h" | 5 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "chrome/browser/chromeos/login/startup_utils.h" |
11 #include "chrome/browser/chromeos/login/user_manager.h" | 12 #include "chrome/browser/chromeos/login/user_manager.h" |
12 #include "chrome/browser/chromeos/login/wizard_controller.h" | 13 #include "chrome/browser/chromeos/login/wizard_controller.h" |
13 #include "chrome/browser/chromeos/settings/cros_settings.h" | 14 #include "chrome/browser/chromeos/settings/cros_settings.h" |
14 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 15 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
15 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
16 #include "chromeos/dbus/power_manager_client.h" | 17 #include "chromeos/dbus/power_manager_client.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 | 20 |
20 using chromeos::CrosSettings; | 21 using chromeos::CrosSettings; |
21 using chromeos::DBusThreadManager; | 22 using chromeos::DBusThreadManager; |
22 using chromeos::UpdateEngineClient; | 23 using chromeos::UpdateEngineClient; |
23 using chromeos::UserManager; | 24 using chromeos::UserManager; |
24 using chromeos::WizardController; | 25 using chromeos::WizardController; |
25 | 26 |
26 VersionUpdater* VersionUpdater::Create() { | 27 VersionUpdater* VersionUpdater::Create() { |
27 return new VersionUpdaterCros; | 28 return new VersionUpdaterCros; |
28 } | 29 } |
29 | 30 |
30 void VersionUpdaterCros::CheckForUpdate(const StatusCallback& callback) { | 31 void VersionUpdaterCros::CheckForUpdate(const StatusCallback& callback) { |
31 callback_ = callback; | 32 callback_ = callback; |
32 | 33 |
33 UpdateEngineClient* update_engine_client = | 34 UpdateEngineClient* update_engine_client = |
34 DBusThreadManager::Get()->GetUpdateEngineClient(); | 35 DBusThreadManager::Get()->GetUpdateEngineClient(); |
35 update_engine_client->AddObserver(this); | 36 update_engine_client->AddObserver(this); |
36 | 37 |
37 // Make sure that libcros is loaded and OOBE is complete. | 38 // Make sure that libcros is loaded and OOBE is complete. |
38 if (!WizardController::default_controller() || | 39 if (!WizardController::default_controller() || |
39 WizardController::IsDeviceRegistered()) { | 40 chromeos::StartupUtils::IsDeviceRegistered()) { |
40 update_engine_client->RequestUpdateCheck( | 41 update_engine_client->RequestUpdateCheck( |
41 base::Bind(&VersionUpdaterCros::OnUpdateCheck, | 42 base::Bind(&VersionUpdaterCros::OnUpdateCheck, |
42 weak_ptr_factory_.GetWeakPtr())); | 43 weak_ptr_factory_.GetWeakPtr())); |
43 } | 44 } |
44 } | 45 } |
45 | 46 |
46 void VersionUpdaterCros::RelaunchBrowser() const { | 47 void VersionUpdaterCros::RelaunchBrowser() const { |
47 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 48 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
48 } | 49 } |
49 | 50 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 UpdateEngineClient::UpdateCheckResult result) { | 135 UpdateEngineClient::UpdateCheckResult result) { |
135 // If version updating is not implemented, this binary is the most up-to-date | 136 // If version updating is not implemented, this binary is the most up-to-date |
136 // possible with respect to automatic updating. | 137 // possible with respect to automatic updating. |
137 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) | 138 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) |
138 callback_.Run(UPDATED, 0, string16()); | 139 callback_.Run(UPDATED, 0, string16()); |
139 } | 140 } |
140 | 141 |
141 void VersionUpdaterCros::UpdateSelectedChannel(const std::string& channel) { | 142 void VersionUpdaterCros::UpdateSelectedChannel(const std::string& channel) { |
142 channel_callback_.Run(channel); | 143 channel_callback_.Run(channel); |
143 } | 144 } |
OLD | NEW |