Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
index 834b40e073fd334af5ce5cb0adf5e144df8b23e5..053753f739f74493a474b2596b9598fa8a9b4f4d 100644 |
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
@@ -17,8 +17,6 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/browser_process_platform_part_chromeos.h" |
#include "chrome/browser/browser_shutdown.h" |
-#include "chrome/browser/chromeos/cros/cros_library.h" |
-#include "chrome/browser/chromeos/cros/network_library.h" |
#include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
#include "chrome/browser/chromeos/login/hwid_checker.h" |
@@ -47,6 +45,8 @@ |
#include "chromeos/dbus/power_manager_client.h" |
#include "chromeos/ime/input_method_manager.h" |
#include "chromeos/ime/xkeyboard.h" |
+#include "chromeos/network/network_state.h" |
+#include "chromeos/network/network_state_handler.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "google_apis/gaia/gaia_auth_util.h" |
@@ -54,6 +54,7 @@ |
#include "google_apis/gaia/gaia_urls.h" |
#include "grit/chromium_strings.h" |
#include "grit/generated_resources.h" |
+#include "third_party/cros_system_api/dbus/service_constants.h" |
#include "ui/base/l10n/l10n_util.h" |
#if defined(USE_AURA) |
@@ -185,21 +186,10 @@ bool IsSigninScreenError(ErrorScreen::ErrorState error_state) { |
error_state == ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; |
} |
-// Returns a pointer to a Network instance by service path or NULL if |
-// network can not be found. |
-Network* FindNetworkByPath(const std::string& service_path) { |
- CrosLibrary* cros = CrosLibrary::Get(); |
- if (!cros) |
- return NULL; |
- NetworkLibrary* network_library = cros->GetNetworkLibrary(); |
- if (!network_library) |
- return NULL; |
- return network_library->FindNetworkByPath(service_path); |
-} |
- |
// Returns network name by service path. |
std::string GetNetworkName(const std::string& service_path) { |
- Network* network = FindNetworkByPath(service_path); |
+ const NetworkState* network = |
+ NetworkStateHandler::Get()->GetNetworkState(service_path); |
if (!network) |
return std::string(); |
return network->name(); |
@@ -207,31 +197,33 @@ std::string GetNetworkName(const std::string& service_path) { |
// Returns network unique id by service path. |
std::string GetNetworkUniqueId(const std::string& service_path) { |
- Network* network = FindNetworkByPath(service_path); |
+ const NetworkState* network = |
+ NetworkStateHandler::Get()->GetNetworkState(service_path); |
if (!network) |
return std::string(); |
- return network->unique_id(); |
+ return network->guid(); |
} |
// Returns captive portal state for a network by its service path. |
NetworkPortalDetector::CaptivePortalState GetCaptivePortalState( |
const std::string& service_path) { |
NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); |
- Network* network = FindNetworkByPath(service_path); |
+ const NetworkState* network = |
+ NetworkStateHandler::Get()->GetNetworkState(service_path); |
if (!detector || !network) |
return NetworkPortalDetector::CaptivePortalState(); |
return detector->GetCaptivePortalState(network); |
} |
void RecordDiscrepancyWithShill( |
- const Network* network, |
+ const NetworkState* network, |
const NetworkPortalDetector::CaptivePortalStatus status) { |
- if (network->online()) { |
+ if (network->connection_state() == flimflam::kStateOnline) { |
UMA_HISTOGRAM_ENUMERATION( |
"CaptivePortal.OOBE.DiscrepancyWithShill_Online", |
status, |
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT); |
- } else if (network->restricted_pool()) { |
+ } else if (network->connection_state() == flimflam::kStatePortal) { |
UMA_HISTOGRAM_ENUMERATION( |
"CaptivePortal.OOBE.DiscrepancyWithShill_RestrictedPool", |
status, |
@@ -248,7 +240,8 @@ void RecordDiscrepancyWithShill( |
// network is online but NetworkPortalDetector claims that it's behind |
// portal) for the network identified by |service_path|. |
void RecordNetworkPortalDetectorStats(const std::string& service_path) { |
- const Network* network = FindNetworkByPath(service_path); |
+ const NetworkState* network = |
+ NetworkStateHandler::Get()->GetNetworkState(service_path); |
if (!network) |
return; |
NetworkPortalDetector::CaptivePortalState state = |
@@ -265,19 +258,20 @@ void RecordNetworkPortalDetectorStats(const std::string& service_path) { |
NOTREACHED(); |
break; |
case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE: |
- if (network->online() || network->restricted_pool()) |
+ if (network->connection_state() == flimflam::kStateOnline || |
+ network->connection_state() == flimflam::kStatePortal) |
RecordDiscrepancyWithShill(network, state.status); |
break; |
case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: |
- if (!network->online()) |
+ if (network->connection_state() != flimflam::kStateOnline) |
RecordDiscrepancyWithShill(network, state.status); |
break; |
case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: |
- if (!network->restricted_pool()) |
+ if (network->connection_state() != flimflam::kStatePortal) |
RecordDiscrepancyWithShill(network, state.status); |
break; |
case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: |
- if (!network->online()) |
+ if (network->connection_state() != flimflam::kStateOnline) |
RecordDiscrepancyWithShill(network, state.status); |
break; |
case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: |
@@ -458,7 +452,7 @@ void SigninScreenHandler::OnNetworkReady() { |
void SigninScreenHandler::UpdateState(NetworkStateInformer::State state, |
const std::string& service_path, |
- ConnectionType connection_type, |
+ const std::string& connection_type, |
const std::string& reason) { |
UpdateStateInternal(state, service_path, connection_type, reason, false); |
} |
@@ -489,9 +483,9 @@ void SigninScreenHandler::UpdateUIState(UIState ui_state, |
// TODO (ygorshenin@): split this method into small parts. |
void SigninScreenHandler::UpdateStateInternal( |
NetworkStateInformer::State state, |
- const std::string service_path, |
- ConnectionType connection_type, |
- std::string reason, |
+ const std::string& service_path, |
+ const std::string& connection_type, |
+ const std::string& reason, |
bool force_update) { |
// Skip "update" notification about OFFLINE state from |
// NetworkStateInformer if previous notification already was |
@@ -604,7 +598,7 @@ void SigninScreenHandler::UpdateStateInternal( |
if ((!is_online || is_gaia_loading_timeout) && is_gaia_signin && |
!offline_login_active_) { |
- SetupAndShowOfflineMessage(state, service_path, connection_type, reason, |
+ SetupAndShowOfflineMessage(state, service_path, reason, |
is_proxy_error, is_under_captive_portal, |
is_gaia_loading_timeout); |
} else { |
@@ -616,7 +610,6 @@ void SigninScreenHandler::UpdateStateInternal( |
void SigninScreenHandler::SetupAndShowOfflineMessage( |
NetworkStateInformer:: State state, |
const std::string& service_path, |
- ConnectionType connection_type, |
const std::string& reason, |
bool is_proxy_error, |
bool is_under_captive_portal, |
@@ -668,7 +661,6 @@ void SigninScreenHandler::SetupAndShowOfflineMessage( |
if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { |
DictionaryValue params; |
- params.SetInteger("lastNetworkType", static_cast<int>(connection_type)); |
error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); |
error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); |
} |