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

Unified Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 12211111: Added UMA records for OOBE portal detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Most of UMA records are performed in the UI context. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
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 cd0b3b50f854a30a6757e9831dff5f3ef7e8259a..d4be7ba6e9a0086327d576db0dd8e682d6337db9 100644
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -195,6 +196,69 @@ NetworkPortalDetector::CaptivePortalState GetCaptivePortalState(
return detector->GetCaptivePortalState(network);
}
+void RecordDiscrepancyWithShill(
+ const Network* network,
+ const NetworkPortalDetector::CaptivePortalStatus status) {
+ if (network->online()) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "CaptivePortal.OOBE.DiscrepancyWithShill.Online",
+ status,
+ NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
+ } else if (network->restricted_pool()) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "CaptivePortal.OOBE.DiscrepancyWithShill.RestrictedPool",
+ status,
+ NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION(
+ "CaptivePortal.OOBE.DiscrepancyWithShill.Offline",
+ status,
+ NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
+ }
+}
+
+// Record state and descripancies with shill (e.g. shill thinks that
+// 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);
+ if (!network)
+ return;
+ NetworkPortalDetector::CaptivePortalState state =
+ GetCaptivePortalState(service_path);
+ if (state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN)
+ return;
+
+ UMA_HISTOGRAM_ENUMERATION("CaptivePortal.OOBE.DetectionResult",
+ state.status,
+ NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
+
+ switch (state.status) {
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN:
+ NOTREACHED();
+ break;
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE:
+ if (network->online() || network->restricted_pool())
+ RecordDiscrepancyWithShill(network, state.status);
+ break;
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE:
+ if (!network->online())
+ RecordDiscrepancyWithShill(network, state.status);
+ break;
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL:
+ if (!network->restricted_pool())
+ RecordDiscrepancyWithShill(network, state.status);
+ break;
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
+ if (!network->online())
+ RecordDiscrepancyWithShill(network, state.status);
+ break;
+ case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT:
+ NOTREACHED();
+ break;
+ }
+}
+
} // namespace
// SigninScreenHandler implementation ------------------------------------------
@@ -552,6 +616,11 @@ void SigninScreenHandler::UpdateStateInternal(
<< "network_id=" << network_id << ", "
<< "reason=" << reason << ", "
<< "is_under_captive_portal=" << is_under_captive_portal;
+
+ // Record portal detection stats only if we're going to show or
+ // change state of the error screen.
+ RecordNetworkPortalDetectorStats(service_path);
+
if (is_proxy_error) {
error_screen_actor_->ShowProxyError();
} else if (is_under_captive_portal) {

Powered by Google App Engine
This is Rietveld 408576698