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

Unified Diff: components/gcm_driver/instance_id/instance_id_driver.cc

Issue 1128123003: Implement InstanceID API functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 years, 7 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: components/gcm_driver/instance_id/instance_id_driver.cc
diff --git a/components/gcm_driver/instance_id/instance_id_driver.cc b/components/gcm_driver/instance_id/instance_id_driver.cc
index f0ea456a65f4e86eaeca57aa2b14d92059c69e31..edb5270ff0bd2868bc1b28425522f5c48c4ef4c2 100644
--- a/components/gcm_driver/instance_id/instance_id_driver.cc
+++ b/components/gcm_driver/instance_id/instance_id_driver.cc
@@ -4,10 +4,29 @@
#include "components/gcm_driver/instance_id/instance_id_driver.h"
+#include "base/metrics/field_trial.h"
#include "components/gcm_driver/instance_id/instance_id.h"
namespace instance_id {
+namespace {
+#if !defined(OS_ANDROID)
+const char kInstanceIDFieldTrialName[] = "InstanceID";
+const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled";
+#endif // !defined(OS_ANDROID)
+} // namespace
+
+// static
+bool InstanceIDDriver::IsInstanceIDEnabled() {
+#if defined(OS_ANDROID)
+ return true;
+#else
+ std::string group_name =
+ base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName);
+ return group_name == kInstanceIDFieldTrialEnabledGroupName;
+#endif // defined(OS_ANDROID)
+}
+
InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver)
: gcm_driver_(gcm_driver),
instance_id_map_deleter_(&instance_id_map_) {

Powered by Google App Engine
This is Rietveld 408576698