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

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

Issue 1830983002: Implement InstanceIDAndroid using InstanceIDWithSubtype.java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid1subtype
Patch Set: Rebase Created 4 years, 8 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
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 "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 #if !defined(OS_ANDROID)
16 const char kInstanceIDFieldTrialName[] = "InstanceID"; 15 const char kInstanceIDFieldTrialName[] = "InstanceID";
17 const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled"; 16 const char kInstanceIDFieldTrialEnabledGroupName[] = "Enabled";
18 #endif // !defined(OS_ANDROID)
19 } // namespace 17 } // namespace
20 18
21 // static 19 // static
22 bool InstanceIDDriver::IsInstanceIDEnabled() { 20 bool InstanceIDDriver::IsInstanceIDEnabled() {
23 #if defined(OS_ANDROID)
24 // Not implemented yet.
25 return false;
26 #else
27 std::string group_name = 21 std::string group_name =
28 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); 22 base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName);
29 return group_name == kInstanceIDFieldTrialEnabledGroupName; 23 return group_name == kInstanceIDFieldTrialEnabledGroupName;
30 #endif // defined(OS_ANDROID)
31 } 24 }
32 25
33 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) 26 InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver)
34 : gcm_driver_(gcm_driver) { 27 : gcm_driver_(gcm_driver) {
35 } 28 }
36 29
37 InstanceIDDriver::~InstanceIDDriver() { 30 InstanceIDDriver::~InstanceIDDriver() {
38 } 31 }
39 32
40 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { 33 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) {
(...skipping 11 matching lines...) Expand all
52 45
53 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { 46 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) {
54 instance_id_map_.erase(app_id); 47 instance_id_map_.erase(app_id);
55 } 48 }
56 49
57 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { 50 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const {
58 return instance_id_map_.find(app_id) != instance_id_map_.end(); 51 return instance_id_map_.find(app_id) != instance_id_map_.end();
59 } 52 }
60 53
61 } // namespace instance_id 54 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698