| 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 8535853e0d8e786dc26ba04e3232405ea462a1e8..fd878bc20d8fe7e14fb7bf4a89601a361b42aa67 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| @@ -18,8 +18,6 @@
|
| #include "chrome/browser/browser_shutdown.h"
|
| #include "chrome/browser/browsing_data/browsing_data_helper.h"
|
| #include "chrome/browser/browsing_data/browsing_data_remover.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:
|
| @@ -461,7 +455,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);
|
| }
|
| @@ -492,9 +486,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
|
| @@ -607,7 +601,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 {
|
| @@ -619,7 +613,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,
|
| @@ -671,7 +664,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);
|
| }
|
|
|