| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/gcm_driver/instance_id/instance_id_driver.h" | 5 #include "components/gcm_driver/instance_id/instance_id_driver.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "components/gcm_driver/gcm_driver.h" | 9 #include "components/gcm_driver/gcm_driver.h" |
| 10 #include "components/gcm_driver/instance_id/instance_id.h" | 10 #include "components/gcm_driver/instance_id/instance_id.h" |
| 11 | 11 |
| 12 namespace instance_id { | 12 namespace instance_id { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 const char kInstanceIDFieldTrialName[] = "InstanceID"; | 15 const char kInstanceIDFieldTrialName[] = "InstanceID"; |
| 16 const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled"; | 16 const char kInstanceIDFieldTrialDisabledGroupName[] = "Disabled"; |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 bool InstanceIDDriver::IsInstanceIDEnabled() { | 20 bool InstanceIDDriver::IsInstanceIDEnabled() { |
| 21 std::string group_name = | 21 std::string group_name = |
| 22 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); | 22 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); |
| 23 return group_name == kInstanceIDFieldTrialEnabledGroupName; | 23 return group_name != kInstanceIDFieldTrialDisabledGroupName; |
| 24 } | 24 } |
| 25 | 25 |
| 26 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) | 26 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) |
| 27 : gcm_driver_(gcm_driver) { | 27 : gcm_driver_(gcm_driver) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 InstanceIDDriver::~InstanceIDDriver() { | 30 InstanceIDDriver::~InstanceIDDriver() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { | 33 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { | 46 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { |
| 47 instance_id_map_.erase(app_id); | 47 instance_id_map_.erase(app_id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { | 50 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { |
| 51 return instance_id_map_.find(app_id) != instance_id_map_.end(); | 51 return instance_id_map_.find(app_id) != instance_id_map_.end(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace instance_id | 54 } // namespace instance_id |
| OLD | NEW |