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

Side by Side Diff: chrome/browser/ui/webui/help/version_updater_chromeos.cc

Issue 449623003: Integrate About page into Settings for Chrome OS settings in a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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" 13 #include "chrome/browser/chromeos/login/users/user_manager.h"
14 #include "chrome/browser/chromeos/login/wizard_controller.h" 14 #include "chrome/browser/chromeos/login/wizard_controller.h"
15 #include "chrome/browser/chromeos/settings/cros_settings.h" 15 #include "chrome/browser/chromeos/settings/cros_settings.h"
16 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" 16 #include "chrome/browser/ui/webui/help/help_utils.h"
17 #include "chromeos/dbus/dbus_thread_manager.h" 17 #include "chromeos/dbus/dbus_thread_manager.h"
18 #include "chromeos/dbus/power_manager_client.h" 18 #include "chromeos/dbus/power_manager_client.h"
19 #include "chromeos/network/network_handler.h" 19 #include "chromeos/network/network_handler.h"
20 #include "chromeos/network/network_state.h" 20 #include "chromeos/network/network_state.h"
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"
(...skipping 20 matching lines...) Expand all
47 47
48 NetworkStatus GetNetworkStatus(const chromeos::NetworkState* network) { 48 NetworkStatus GetNetworkStatus(const chromeos::NetworkState* network) {
49 if (!network || !network->IsConnectedState()) // Offline state. 49 if (!network || !network->IsConnectedState()) // Offline state.
50 return NETWORK_STATUS_OFFLINE; 50 return NETWORK_STATUS_OFFLINE;
51 51
52 // The connection type checking strategy must be the same as the one 52 // The connection type checking strategy must be the same as the one
53 // used in update engine. 53 // used in update engine.
54 if (network->type() == shill::kTypeBluetooth) 54 if (network->type() == shill::kTypeBluetooth)
55 return NETWORK_STATUS_DISALLOWED; 55 return NETWORK_STATUS_DISALLOWED;
56 if (network->type() == shill::kTypeCellular && 56 if (network->type() == shill::kTypeCellular &&
57 !help_utils_chromeos::IsUpdateOverCellularAllowed()) { 57 !help_utils::IsUpdateOverCellularAllowed()) {
58 return NETWORK_STATUS_DISALLOWED; 58 return NETWORK_STATUS_DISALLOWED;
59 } 59 }
60 return NETWORK_STATUS_ALLOWED; 60 return NETWORK_STATUS_ALLOWED;
61 } 61 }
62 62
63 // Returns true if auto-update is disabled by the system administrator. 63 // Returns true if auto-update is disabled by the system administrator.
64 bool IsAutoUpdateDisabled() { 64 bool IsAutoUpdateDisabled() {
65 bool update_disabled = kDefaultAutoUpdateDisabled; 65 bool update_disabled = kDefaultAutoUpdateDisabled;
66 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); 66 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get();
67 if (!settings) 67 if (!settings)
(...skipping 29 matching lines...) Expand all
97 // to a network for which updates are disallowed. 97 // to a network for which updates are disallowed.
98 NetworkStatus status = GetNetworkStatus(network); 98 NetworkStatus status = GetNetworkStatus(network);
99 if (status == NETWORK_STATUS_OFFLINE) { 99 if (status == NETWORK_STATUS_OFFLINE) {
100 callback_.Run(FAILED_OFFLINE, 0, 100 callback_.Run(FAILED_OFFLINE, 0,
101 l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE)); 101 l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE));
102 return; 102 return;
103 } else if (status == NETWORK_STATUS_DISALLOWED) { 103 } else if (status == NETWORK_STATUS_DISALLOWED) {
104 base::string16 message = 104 base::string16 message =
105 l10n_util::GetStringFUTF16( 105 l10n_util::GetStringFUTF16(
106 IDS_UPGRADE_DISALLOWED, 106 IDS_UPGRADE_DISALLOWED,
107 help_utils_chromeos::GetConnectionTypeAsUTF16(network->type())); 107 help_utils::GetConnectionTypeAsUTF16(network->type()));
108 callback_.Run(FAILED_CONNECTION_TYPE_DISALLOWED, 0, message); 108 callback_.Run(FAILED_CONNECTION_TYPE_DISALLOWED, 0, message);
109 return; 109 return;
110 } 110 }
111 111
112 UpdateEngineClient* update_engine_client = 112 UpdateEngineClient* update_engine_client =
113 DBusThreadManager::Get()->GetUpdateEngineClient(); 113 DBusThreadManager::Get()->GetUpdateEngineClient();
114 update_engine_client->AddObserver(this); 114 update_engine_client->AddObserver(this);
115 115
116 // Make sure that libcros is loaded and OOBE is complete. 116 // Make sure that libcros is loaded and OOBE is complete.
117 if (!WizardController::default_controller() || 117 if (!WizardController::default_controller() ||
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698