| 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/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 13 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 14 #include "chrome/browser/chromeos/login/wizard_controller.h" | 13 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 14 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 16 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" | 15 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "chromeos/dbus/power_manager_client.h" | 17 #include "chromeos/dbus/power_manager_client.h" |
| 19 #include "chromeos/network/network_handler.h" | 18 #include "chromeos/network/network_handler.h" |
| 20 #include "chromeos/network/network_state.h" | 19 #include "chromeos/network/network_state.h" |
| 21 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
| 22 #include "chromeos/settings/cros_settings_names.h" | 21 #include "chromeos/settings/cros_settings_names.h" |
| 22 #include "components/user_manager/user_manager.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; | 31 using user_manager::UserManager; |
| 32 using chromeos::WizardController; | 32 using chromeos::WizardController; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 // Network status in the context of device update. | 36 // Network status in the context of device update. |
| 37 enum NetworkStatus { | 37 enum NetworkStatus { |
| 38 // It's allowed in device policy to use current network for update. | 38 // It's allowed in device policy to use current network for update. |
| 39 NETWORK_STATUS_ALLOWED = 0, | 39 NETWORK_STATUS_ALLOWED = 0, |
| 40 // It's disallowed in device policy to use current network for update. | 40 // It's disallowed in device policy to use current network for update. |
| 41 NETWORK_STATUS_DISALLOWED, | 41 NETWORK_STATUS_DISALLOWED, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 weak_ptr_factory_.GetWeakPtr())); | 121 weak_ptr_factory_.GetWeakPtr())); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 void VersionUpdaterCros::RelaunchBrowser() const { | 125 void VersionUpdaterCros::RelaunchBrowser() const { |
| 126 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 126 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void VersionUpdaterCros::SetChannel(const std::string& channel, | 129 void VersionUpdaterCros::SetChannel(const std::string& channel, |
| 130 bool is_powerwash_allowed) { | 130 bool is_powerwash_allowed) { |
| 131 if (UserManager::Get()->IsCurrentUserOwner()) { | 131 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { |
| 132 // For local owner set the field in the policy blob. | 132 // For local owner set the field in the policy blob. |
| 133 CrosSettings::Get()->SetString(chromeos::kReleaseChannel, channel); | 133 CrosSettings::Get()->SetString(chromeos::kReleaseChannel, channel); |
| 134 } | 134 } |
| 135 DBusThreadManager::Get()->GetUpdateEngineClient()-> | 135 DBusThreadManager::Get()->GetUpdateEngineClient()-> |
| 136 SetChannel(channel, is_powerwash_allowed); | 136 SetChannel(channel, is_powerwash_allowed); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void VersionUpdaterCros::GetChannel(bool get_current_channel, | 139 void VersionUpdaterCros::GetChannel(bool get_current_channel, |
| 140 const ChannelCallback& cb) { | 140 const ChannelCallback& cb) { |
| 141 UpdateEngineClient* update_engine_client = | 141 UpdateEngineClient* update_engine_client = |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 last_operation_ = status.status; | 208 last_operation_ = status.status; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void VersionUpdaterCros::OnUpdateCheck( | 211 void VersionUpdaterCros::OnUpdateCheck( |
| 212 UpdateEngineClient::UpdateCheckResult result) { | 212 UpdateEngineClient::UpdateCheckResult result) { |
| 213 // If version updating is not implemented, this binary is the most up-to-date | 213 // If version updating is not implemented, this binary is the most up-to-date |
| 214 // possible with respect to automatic updating. | 214 // possible with respect to automatic updating. |
| 215 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) | 215 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) |
| 216 callback_.Run(UPDATED, 0, base::string16()); | 216 callback_.Run(UPDATED, 0, base::string16()); |
| 217 } | 217 } |
| OLD | NEW |