OLD | NEW |
---|---|
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/services/gcm/instance_id/instance_id_profile_service.h" | 5 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 9 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
11 #include "chrome/common/chrome_version_info.h" | 11 #include "chrome/common/chrome_version_info.h" |
12 #include "components/gcm_driver/instance_id/instance_id_driver.h" | 12 #include "components/gcm_driver/instance_id/instance_id_driver.h" |
13 | 13 |
14 namespace instance_id { | 14 namespace instance_id { |
15 | 15 |
16 // static | 16 // static |
17 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) { | 17 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) { |
18 // Instance ID depends on GCM which has to been enabled. | 18 // Instance ID depends on GCM which has to been enabled. |
19 if (!gcm::GCMProfileService::IsGCMEnabled(profile)) | 19 if (!gcm::GCMProfileService::IsGCMEnabled(profile)) |
20 return false; | 20 return false; |
21 | 21 |
22 // Enabled for trunk build. | 22 // Enabled only for trunk/canary/dev builds. |
23 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 23 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
24 if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN) | 24 if (channel == chrome::VersionInfo::CHANNEL_BETA || |
25 return true; | 25 channel == chrome::VersionInfo::CHANNEL_STABLE) { |
26 return false; | |
27 } | |
not at google - send to devlin
2015/05/15 23:07:26
you could also grab the API Feature and check agai
jianli
2015/05/15 23:11:37
InstanceIDProfileService might be used by others,
| |
26 | 28 |
27 return InstanceIDDriver::IsInstanceIDEnabled(); | 29 return InstanceIDDriver::IsInstanceIDEnabled(); |
28 } | 30 } |
29 | 31 |
30 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) { | 32 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) { |
31 DCHECK(!profile->IsOffTheRecord()); | 33 DCHECK(!profile->IsOffTheRecord()); |
32 | 34 |
33 driver_.reset(new InstanceIDDriver( | 35 driver_.reset(new InstanceIDDriver( |
34 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver())); | 36 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver())); |
35 } | 37 } |
36 | 38 |
37 InstanceIDProfileService::~InstanceIDProfileService() { | 39 InstanceIDProfileService::~InstanceIDProfileService() { |
38 } | 40 } |
39 | 41 |
40 } // namespace instance_id | 42 } // namespace instance_id |
OLD | NEW |