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
3 // found in the LICENSE file.
5 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service.h"
7 #include "base/logging.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/services/gcm/gcm_profile_service.h"
10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
11 #include "components/gcm_driver/instance_id/instance_id_driver.h"
13 namespace instance_id
{
16 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile
* profile
) {
17 // Instance ID depends on GCM which has to been enabled.
18 if (!gcm::GCMProfileService::IsGCMEnabled(profile
))
21 return InstanceIDDriver::IsInstanceIDEnabled();
24 InstanceIDProfileService::InstanceIDProfileService(Profile
* profile
) {
25 DCHECK(!profile
->IsOffTheRecord());
27 driver_
.reset(new InstanceIDDriver(
28 gcm::GCMProfileServiceFactory::GetForProfile(profile
)->driver()));
31 InstanceIDProfileService::~InstanceIDProfileService() {
34 } // namespace instance_id