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/gcm/instance_id/instance_id_profile_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/gcm/gcm_profile_service_factory.h" |
8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | |
10 #include "components/gcm_driver/gcm_profile_service.h" | 10 #include "components/gcm_driver/gcm_profile_service.h" |
11 #include "components/gcm_driver/instance_id/instance_id_driver.h" | 11 #include "components/gcm_driver/instance_id/instance_id_driver.h" |
12 | 12 |
13 namespace instance_id { | 13 namespace instance_id { |
14 | 14 |
15 // static | 15 // static |
16 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) { | 16 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) { |
17 // Instance ID depends on GCM which has to been enabled. | 17 // Instance ID depends on GCM which has to been enabled. |
18 if (!gcm::GCMProfileService::IsGCMEnabled(profile->GetPrefs())) | 18 if (!gcm::GCMProfileService::IsGCMEnabled(profile->GetPrefs())) |
19 return false; | 19 return false; |
20 | 20 |
21 return InstanceIDDriver::IsInstanceIDEnabled(); | 21 return InstanceIDDriver::IsInstanceIDEnabled(); |
22 } | 22 } |
23 | 23 |
24 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) { | 24 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) { |
25 DCHECK(!profile->IsOffTheRecord()); | 25 DCHECK(!profile->IsOffTheRecord()); |
26 | 26 |
27 driver_.reset(new InstanceIDDriver( | 27 driver_.reset(new InstanceIDDriver( |
28 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver())); | 28 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver())); |
29 } | 29 } |
30 | 30 |
31 InstanceIDProfileService::~InstanceIDProfileService() { | 31 InstanceIDProfileService::~InstanceIDProfileService() { |
32 } | 32 } |
33 | 33 |
34 } // namespace instance_id | 34 } // namespace instance_id |
OLD | NEW |