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

Unified Diff: chrome/browser/metrics/metrics_log.cc

Issue 12082090: [net] Add WifiPhyMode to SystemProfile (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix logic 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/metrics/metrics_log.cc
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 3e518144c7e8ceaf119391f4ca66b99e67aaabf3..4a03a161194ed1f4f93ceff1b8164f9c32eeec9d 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/autocomplete/autocomplete_result.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/metrics/metrics_network_observer.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_version_info.h"
@@ -45,7 +46,6 @@
#include "content/public/common/content_client.h"
#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
-#include "net/base/network_change_notifier.h"
#include "ui/gfx/screen.h"
#include "webkit/plugins/webplugininfo.h"
@@ -308,65 +308,6 @@ void WriteScreenDPIInformationProto(SystemProfileProto::Hardware* hardware) {
} // namespace
-class MetricsLog::NetworkObserver
- : public net::NetworkChangeNotifier::ConnectionTypeObserver {
- public:
- NetworkObserver() : connection_type_is_ambiguous_(false) {
- net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
- Reset();
- }
- virtual ~NetworkObserver() {
- net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
- }
-
- void Reset() {
- connection_type_is_ambiguous_ = false;
- connection_type_ = net::NetworkChangeNotifier::GetConnectionType();
- }
-
- // ConnectionTypeObserver:
- virtual void OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) OVERRIDE {
- if (type == net::NetworkChangeNotifier::CONNECTION_NONE)
- return;
- if (type != connection_type_ &&
- connection_type_ != net::NetworkChangeNotifier::CONNECTION_NONE) {
- connection_type_is_ambiguous_ = true;
- }
- connection_type_ = type;
- }
-
- bool connection_type_is_ambiguous() const {
- return connection_type_is_ambiguous_;
- }
-
- SystemProfileProto::Network::ConnectionType connection_type() const {
- switch (connection_type_) {
- case net::NetworkChangeNotifier::CONNECTION_NONE:
- case net::NetworkChangeNotifier::CONNECTION_UNKNOWN:
- return SystemProfileProto::Network::CONNECTION_UNKNOWN;
- case net::NetworkChangeNotifier::CONNECTION_ETHERNET:
- return SystemProfileProto::Network::CONNECTION_ETHERNET;
- case net::NetworkChangeNotifier::CONNECTION_WIFI:
- return SystemProfileProto::Network::CONNECTION_WIFI;
- case net::NetworkChangeNotifier::CONNECTION_2G:
- return SystemProfileProto::Network::CONNECTION_2G;
- case net::NetworkChangeNotifier::CONNECTION_3G:
- return SystemProfileProto::Network::CONNECTION_3G;
- case net::NetworkChangeNotifier::CONNECTION_4G:
- return SystemProfileProto::Network::CONNECTION_4G;
- }
- NOTREACHED();
- return SystemProfileProto::Network::CONNECTION_UNKNOWN;
- }
-
- private:
- bool connection_type_is_ambiguous_;
- net::NetworkChangeNotifier::ConnectionType connection_type_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkObserver);
-};
-
GoogleUpdateMetrics::GoogleUpdateMetrics() : is_system_install(false) {}
GoogleUpdateMetrics::~GoogleUpdateMetrics() {}
@@ -376,7 +317,7 @@ static base::LazyInstance<std::string>::Leaky
MetricsLog::MetricsLog(const std::string& client_id, int session_id)
: MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()),
- network_observer_(new NetworkObserver()) {}
+ network_observer_(new MetricsNetworkObserver()) {}
MetricsLog::~MetricsLog() {}
@@ -878,6 +819,9 @@ void MetricsLog::RecordEnvironmentProto(
network->set_connection_type_is_ambiguous(
network_observer_->connection_type_is_ambiguous());
network->set_connection_type(network_observer_->connection_type());
+ network->set_wifi_phy_mode_is_ambiguous(
+ network_observer_->wifi_phy_mode_is_ambiguous());
+ network->set_wifi_phy_mode(network_observer_->wifi_phy_mode());
network_observer_->Reset();
SystemProfileProto::OS* os = system_profile->mutable_os();

Powered by Google App Engine
This is Rietveld 408576698