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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chromeos/network/network_state_handler.h" | 21 #include "chromeos/network/network_state_handler.h" |
22 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "third_party/cros_system_api/dbus/service_constants.h" | 25 #include "third_party/cros_system_api/dbus/service_constants.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 using chromeos::CrosSettings; | 28 using chromeos::CrosSettings; |
29 using chromeos::DBusThreadManager; | 29 using chromeos::DBusThreadManager; |
30 using chromeos::UpdateEngineClient; | 30 using chromeos::UpdateEngineClient; |
31 using chromeos::UserManager; | |
32 using chromeos::WizardController; | 31 using chromeos::WizardController; |
33 | 32 |
34 namespace { | 33 namespace { |
35 | 34 |
36 // Network status in the context of device update. | 35 // Network status in the context of device update. |
37 enum NetworkStatus { | 36 enum NetworkStatus { |
38 // It's allowed in device policy to use current network for update. | 37 // It's allowed in device policy to use current network for update. |
39 NETWORK_STATUS_ALLOWED = 0, | 38 NETWORK_STATUS_ALLOWED = 0, |
40 // It's disallowed in device policy to use current network for update. | 39 // It's disallowed in device policy to use current network for update. |
41 NETWORK_STATUS_DISALLOWED, | 40 NETWORK_STATUS_DISALLOWED, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 weak_ptr_factory_.GetWeakPtr())); | 120 weak_ptr_factory_.GetWeakPtr())); |
122 } | 121 } |
123 } | 122 } |
124 | 123 |
125 void VersionUpdaterCros::RelaunchBrowser() const { | 124 void VersionUpdaterCros::RelaunchBrowser() const { |
126 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 125 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
127 } | 126 } |
128 | 127 |
129 void VersionUpdaterCros::SetChannel(const std::string& channel, | 128 void VersionUpdaterCros::SetChannel(const std::string& channel, |
130 bool is_powerwash_allowed) { | 129 bool is_powerwash_allowed) { |
131 if (UserManager::Get()->IsCurrentUserOwner()) { | 130 if (chromeos::GetUserManager()->IsCurrentUserOwner()) { |
132 // For local owner set the field in the policy blob. | 131 // For local owner set the field in the policy blob. |
133 CrosSettings::Get()->SetString(chromeos::kReleaseChannel, channel); | 132 CrosSettings::Get()->SetString(chromeos::kReleaseChannel, channel); |
134 } | 133 } |
135 DBusThreadManager::Get()->GetUpdateEngineClient()-> | 134 DBusThreadManager::Get()->GetUpdateEngineClient()-> |
136 SetChannel(channel, is_powerwash_allowed); | 135 SetChannel(channel, is_powerwash_allowed); |
137 } | 136 } |
138 | 137 |
139 void VersionUpdaterCros::GetChannel(bool get_current_channel, | 138 void VersionUpdaterCros::GetChannel(bool get_current_channel, |
140 const ChannelCallback& cb) { | 139 const ChannelCallback& cb) { |
141 UpdateEngineClient* update_engine_client = | 140 UpdateEngineClient* update_engine_client = |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 last_operation_ = status.status; | 207 last_operation_ = status.status; |
209 } | 208 } |
210 | 209 |
211 void VersionUpdaterCros::OnUpdateCheck( | 210 void VersionUpdaterCros::OnUpdateCheck( |
212 UpdateEngineClient::UpdateCheckResult result) { | 211 UpdateEngineClient::UpdateCheckResult result) { |
213 // If version updating is not implemented, this binary is the most up-to-date | 212 // If version updating is not implemented, this binary is the most up-to-date |
214 // possible with respect to automatic updating. | 213 // possible with respect to automatic updating. |
215 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) | 214 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) |
216 callback_.Run(UPDATED, 0, base::string16()); | 215 callback_.Run(UPDATED, 0, base::string16()); |
217 } | 216 } |
OLD | NEW |