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

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

Issue 1731913002: Move InstanceID field trial check to extension-specific code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « chrome/browser/extensions/api/instance_id/instance_id_api.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"
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/instance_id/instance_id_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698