| Index: chrome/browser/chromeos/net/network_portal_detector_impl.cc
|
| diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
|
| index fb5e49916b6941e6db64dc9e06f3d3ac67d8a12b..dc14a8790f8c1a574b881b44c7f139bb206ea51f 100644
|
| --- a/chrome/browser/chromeos/net/network_portal_detector_impl.cc
|
| +++ b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
|
| @@ -40,17 +40,17 @@ bool InSession() {
|
| return UserManager::IsInitialized() && UserManager::Get()->IsUserLoggedIn();
|
| }
|
|
|
| -void RecordDetectionResult(NetworkPortalDetector::CaptivePortalStatus status) {
|
| +void RecordDetectionResult(captive_portal::CaptivePortalStatus status) {
|
| if (InSession()) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kSessionDetectionResultHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| } else {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kOobeDetectionResultHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| }
|
| }
|
|
|
| @@ -67,40 +67,40 @@ void RecordDetectionDuration(const base::TimeDelta& duration) {
|
|
|
| void RecordDiscrepancyWithShill(
|
| const NetworkState* network,
|
| - const NetworkPortalDetector::CaptivePortalStatus status) {
|
| + const captive_portal::CaptivePortalStatus status) {
|
| if (InSession()) {
|
| if (network->connection_state() == shill::kStateOnline) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kSessionShillOnlineHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| } else if (network->connection_state() == shill::kStatePortal) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kSessionShillPortalHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| } else if (network->connection_state() == shill::kStateOffline) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kSessionShillOfflineHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| }
|
| } else {
|
| if (network->connection_state() == shill::kStateOnline) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kOobeShillOnlineHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| } else if (network->connection_state() == shill::kStatePortal) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kOobeShillPortalHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| } else if (network->connection_state() == shill::kStateOffline) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| NetworkPortalDetectorImpl::kOobeShillOfflineHistogram,
|
| status,
|
| - NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_COUNT);
|
| }
|
| }
|
| }
|
| @@ -263,7 +263,7 @@ void NetworkPortalDetectorImpl::DefaultNetworkChanged(
|
| StopDetection();
|
|
|
| CaptivePortalState state;
|
| - state.status = CAPTIVE_PORTAL_STATUS_OFFLINE;
|
| + state.status = captive_portal::CAPTIVE_PORTAL_STATUS_OFFLINE;
|
| OnDetectionCompleted(NULL, state);
|
| return;
|
| }
|
| @@ -287,8 +287,8 @@ void NetworkPortalDetectorImpl::DefaultNetworkChanged(
|
| // portal state is unknown (e.g. for freshly created networks),
|
| // offline or if network connection state was changed.
|
| CaptivePortalState state = GetCaptivePortalState(default_network->path());
|
| - if (state.status == CAPTIVE_PORTAL_STATUS_UNKNOWN ||
|
| - state.status == CAPTIVE_PORTAL_STATUS_OFFLINE ||
|
| + if (state.status == captive_portal::CAPTIVE_PORTAL_STATUS_UNKNOWN ||
|
| + state.status == captive_portal::CAPTIVE_PORTAL_STATUS_OFFLINE ||
|
| (!network_changed && connection_state_changed)) {
|
| ScheduleAttempt(base::TimeDelta());
|
| }
|
| @@ -391,7 +391,7 @@ void NetworkPortalDetectorImpl::OnAttemptTimeout() {
|
|
|
| void NetworkPortalDetectorImpl::OnAttemptCompleted(
|
| const CaptivePortalDetector::Results& results) {
|
| - captive_portal::Result result = results.result;
|
| + captive_portal::CaptivePortalResult result = results.result;
|
| int response_code = results.response_code;
|
|
|
| DCHECK(CalledOnValidThread());
|
| @@ -401,7 +401,7 @@ void NetworkPortalDetectorImpl::OnAttemptCompleted(
|
| << "name=" << default_network_name_ << ", "
|
| << "id=" << default_network_id_ << ", "
|
| << "result="
|
| - << CaptivePortalDetector::CaptivePortalResultToString(results.result)
|
| + << captive_portal::CaptivePortalResultToString(results.result)
|
| << ", "
|
| << "response_code=" << results.response_code;
|
|
|
| @@ -426,29 +426,28 @@ void NetworkPortalDetectorImpl::OnAttemptCompleted(
|
| switch (result) {
|
| case captive_portal::RESULT_NO_RESPONSE:
|
| if (state.response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) {
|
| - state.status = CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
|
| + state.status =
|
| + captive_portal::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
|
| } else if (CanPerformAttempt()) {
|
| ScheduleAttempt(results.retry_after_delta);
|
| return;
|
| } else if (network &&
|
| (network->connection_state() == shill::kStatePortal)) {
|
| // Take into account shill's detection results.
|
| - state.status = CAPTIVE_PORTAL_STATUS_PORTAL;
|
| + state.status = captive_portal::CAPTIVE_PORTAL_STATUS_PORTAL;
|
| LOG(WARNING) << "Network name=" << network->name() << ", "
|
| - << "id=" << network->guid() << " "
|
| - << "is marked as "
|
| - << CaptivePortalStatusString(state.status) << " "
|
| - << "despite the fact that CaptivePortalDetector "
|
| - << "received no response";
|
| + << "id=" << network->guid() << " is marked as "
|
| + << captive_portal::CaptivePortalStatusString(state.status)
|
| + << " despite no response from CaptivePortalDetector.";
|
| } else {
|
| - state.status = CAPTIVE_PORTAL_STATUS_OFFLINE;
|
| + state.status = captive_portal::CAPTIVE_PORTAL_STATUS_OFFLINE;
|
| }
|
| break;
|
| case captive_portal::RESULT_INTERNET_CONNECTED:
|
| - state.status = CAPTIVE_PORTAL_STATUS_ONLINE;
|
| + state.status = captive_portal::CAPTIVE_PORTAL_STATUS_ONLINE;
|
| break;
|
| case captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL:
|
| - state.status = CAPTIVE_PORTAL_STATUS_PORTAL;
|
| + state.status = captive_portal::CAPTIVE_PORTAL_STATUS_PORTAL;
|
| break;
|
| default:
|
| break;
|
| @@ -491,17 +490,17 @@ void NetworkPortalDetectorImpl::OnDetectionCompleted(
|
| it->second.response_code != state.response_code) {
|
| VLOG(1) << "Updating Chrome Captive Portal state: "
|
| << "name=" << network->name() << ", "
|
| - << "id=" << network->guid() << ", "
|
| - << "status=" << CaptivePortalStatusString(state.status) << ", "
|
| - << "response_code=" << state.response_code;
|
| + << "id=" << network->guid() << ", status="
|
| + << captive_portal::CaptivePortalStatusString(state.status)
|
| + << ", response_code=" << state.response_code;
|
|
|
| // Record detection duration iff detection result differs from the
|
| // previous one for this network. The reason is to record all stats
|
| // only when network changes it's state.
|
| RecordDetectionStats(network, state.status);
|
| if (it != portal_state_map_.end() &&
|
| - it->second.status == CAPTIVE_PORTAL_STATUS_PORTAL &&
|
| - state.status == CAPTIVE_PORTAL_STATUS_ONLINE) {
|
| + it->second.status == captive_portal::CAPTIVE_PORTAL_STATUS_PORTAL &&
|
| + state.status == captive_portal::CAPTIVE_PORTAL_STATUS_ONLINE) {
|
| RecordPortalToOnlineTransition(state.time - it->second.time);
|
| }
|
|
|
| @@ -524,7 +523,7 @@ bool NetworkPortalDetectorImpl::AttemptTimeoutIsCancelledForTesting() const {
|
|
|
| void NetworkPortalDetectorImpl::RecordDetectionStats(
|
| const NetworkState* network,
|
| - CaptivePortalStatus status) {
|
| + captive_portal::CaptivePortalStatus status) {
|
| // Don't record stats for offline state.
|
| if (!network)
|
| return;
|
| @@ -534,28 +533,28 @@ void NetworkPortalDetectorImpl::RecordDetectionStats(
|
| RecordDetectionResult(status);
|
|
|
| switch (status) {
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_UNKNOWN:
|
| NOTREACHED();
|
| break;
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_OFFLINE:
|
| if (network->connection_state() == shill::kStateOnline ||
|
| network->connection_state() == shill::kStatePortal) {
|
| RecordDiscrepancyWithShill(network, status);
|
| }
|
| break;
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_ONLINE:
|
| if (network->connection_state() != shill::kStateOnline)
|
| RecordDiscrepancyWithShill(network, status);
|
| break;
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_PORTAL:
|
| if (network->connection_state() != shill::kStatePortal)
|
| RecordDiscrepancyWithShill(network, status);
|
| break;
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
|
| if (network->connection_state() != shill::kStateOnline)
|
| RecordDiscrepancyWithShill(network, status);
|
| break;
|
| - case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT:
|
| + case captive_portal::CAPTIVE_PORTAL_STATUS_COUNT:
|
| NOTREACHED();
|
| break;
|
| }
|
|
|