| 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" | |
| 8 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 9 #include "components/gcm_driver/instance_id/instance_id.h" | 8 #include "components/gcm_driver/instance_id/instance_id.h" |
| 10 | 9 |
| 11 namespace instance_id { | 10 namespace instance_id { |
| 12 | 11 |
| 13 namespace { | |
| 14 #if !defined(OS_ANDROID) | |
| 15 const char kInstanceIDFieldTrialName[] = "InstanceID"; | |
| 16 const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled"; | |
| 17 #endif // !defined(OS_ANDROID) | |
| 18 } // namespace | |
| 19 | |
| 20 // static | 12 // static |
| 21 bool InstanceIDDriver::IsInstanceIDEnabled() { | 13 bool InstanceIDDriver::IsInstanceIDEnabled() { |
| 22 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
| 23 // Not implemented yet. | 15 // Not implemented yet. |
| 24 return false; | 16 return false; |
| 25 #else | 17 #else |
| 26 std::string group_name = | 18 return true; |
| 27 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); | |
| 28 return group_name == kInstanceIDFieldTrialEnabledGroupName; | |
| 29 #endif // defined(OS_ANDROID) | 19 #endif // defined(OS_ANDROID) |
| 30 } | 20 } |
| 31 | 21 |
| 32 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) | 22 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) |
| 33 : gcm_driver_(gcm_driver) { | 23 : gcm_driver_(gcm_driver) { |
| 34 } | 24 } |
| 35 | 25 |
| 36 InstanceIDDriver::~InstanceIDDriver() { | 26 InstanceIDDriver::~InstanceIDDriver() { |
| 37 } | 27 } |
| 38 | 28 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 | 39 |
| 50 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { | 40 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { |
| 51 instance_id_map_.erase(app_id); | 41 instance_id_map_.erase(app_id); |
| 52 } | 42 } |
| 53 | 43 |
| 54 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { | 44 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { |
| 55 return instance_id_map_.find(app_id) != instance_id_map_.end(); | 45 return instance_id_map_.find(app_id) != instance_id_map_.end(); |
| 56 } | 46 } |
| 57 | 47 |
| 58 } // namespace instance_id | 48 } // namespace instance_id |
| OLD | NEW |