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

Side by Side Diff: components/gcm_driver/instance_id/instance_id_driver.cc

Issue 1854093002: Enable InstanceID field trial by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid3test
Patch Set: Rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/string_util.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "components/gcm_driver/gcm_driver.h" 10 #include "components/gcm_driver/gcm_driver.h"
10 #include "components/gcm_driver/instance_id/instance_id.h" 11 #include "components/gcm_driver/instance_id/instance_id.h"
11 12
12 namespace instance_id { 13 namespace instance_id {
13 14
14 namespace { 15 namespace {
15 const char kInstanceIDFieldTrialName[] = "InstanceID"; 16 const char kInstanceIDFieldTrialName[] = "InstanceID";
16 const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled"; 17 const char kInstanceIDFieldTrialDisabledGroupPrefix[] = "Disabled";
17 } // namespace 18 } // namespace
18 19
19 // static 20 // static
20 bool InstanceIDDriver::IsInstanceIDEnabled() { 21 bool InstanceIDDriver::IsInstanceIDEnabled() {
21 std::string group_name = 22 std::string group_name =
22 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); 23 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName);
23 return group_name == kInstanceIDFieldTrialEnabledGroupName; 24 return !base::StartsWith(group_name, kInstanceIDFieldTrialDisabledGroupPrefix,
25 base::CompareCase::INSENSITIVE_ASCII);
24 } 26 }
25 27
26 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) 28 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver)
27 : gcm_driver_(gcm_driver) { 29 : gcm_driver_(gcm_driver) {
28 } 30 }
29 31
30 InstanceIDDriver::~InstanceIDDriver() { 32 InstanceIDDriver::~InstanceIDDriver() {
31 } 33 }
32 34
33 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { 35 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) {
(...skipping 11 matching lines...) Expand all
45 47
46 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { 48 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) {
47 instance_id_map_.erase(app_id); 49 instance_id_map_.erase(app_id);
48 } 50 }
49 51
50 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { 52 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const {
51 return instance_id_map_.find(app_id) != instance_id_map_.end(); 53 return instance_id_map_.find(app_id) != instance_id_map_.end();
52 } 54 }
53 55
54 } // namespace instance_id 56 } // namespace instance_id
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698