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

Unified Diff: chrome/browser/metrics/variations/variations_service.h

Issue 10917120: Activate the VariationsService for ChromeOS and ensure that it does not ping the server until the E… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: unit tests refactored Created 8 years, 3 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/variations/variations_service.h
diff --git a/chrome/browser/metrics/variations/variations_service.h b/chrome/browser/metrics/variations/variations_service.h
index 3f341212ecf699343c3fa375ef22928e77eae42e..ae7ac2331fb6d25e65a7ccb24777bf3d17b4a921 100644
--- a/chrome/browser/metrics/variations/variations_service.h
+++ b/chrome/browser/metrics/variations/variations_service.h
@@ -15,6 +15,7 @@
#include "base/timer.h"
#include "chrome/browser/metrics/proto/study.pb.h"
#include "chrome/browser/metrics/proto/trials_seed.pb.h"
+#include "chrome/browser/resource_request_allowed_notifier.h"
#include "chrome/common/chrome_version_info.h"
#include "googleurl/src/gurl.h"
#include "net/base/network_change_notifier.h"
Alexei Svitkine (slow) 2012/09/12 15:15:46 Remove this #include now that you're not using it
SteveT 2012/09/14 20:25:09 Done.
@@ -28,7 +29,7 @@ namespace chrome_variations {
// new seed data from the variations server.
class VariationsService
: public net::URLFetcherDelegate,
- public net::NetworkChangeNotifier::ConnectionTypeObserver{
+ public ResourceRequestAllowedNotifier::Observer {
public:
VariationsService();
virtual ~VariationsService();
@@ -52,6 +53,9 @@ class VariationsService
// Exposed for testing.
void SetWasOfflineDuringLastRequestAttemptForTesting(bool offline);
+ // ResourceRequestAllowedNotifier::Observer implementation:
+ virtual void OnResourceRequestsAllowed() OVERRIDE;
Ilya Sherman 2012/09/11 22:51:27 nit: Can this have private visibility?
SteveT 2012/09/14 20:25:09 Yup! Done!
+
// Register Variations related prefs in Local State.
static void RegisterPrefs(PrefService* prefs);
@@ -73,10 +77,6 @@ class VariationsService
// net::URLFetcherDelegate implementation:
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
- // net::NetworkChangeNotifier::ConnectionTypeObserver implementation.
- virtual void OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
-
// Store the given seed data to the given local prefs. Note that |seed_data|
// is assumed to be the raw serialized protobuf data stored in a string. It
// will be Base64Encoded for storage. If the string is invalid or the encoding
@@ -146,14 +146,14 @@ class VariationsService
// it gets called prior to |StartRepeatedVariationsSeedFetch|.
bool create_trials_from_seed_called_;
- // Tracks whether or not the last seed request attempt failed due to being
- // offline.
- bool was_offline_during_last_request_attempt_;
-
// The timer used to repeatedly ping the server. Keep this as an instance
// member so if VariationsService goes out of scope, the timer is
// automatically canceled.
base::RepeatingTimer<VariationsService> timer_;
+
+ // Helper class used to tell this service if it's allowed to make network
+ // resource requests.
+ ResourceRequestAllowedNotifier resource_request_allowed_notifier_;
};
} // namespace chrome_variations

Powered by Google App Engine
This is Rietveld 408576698