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

Side by Side Diff: chrome/browser/services/gcm/instance_id/instance_id_profile_service.cc

Issue 1128123003: Implement InstanceID API functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 years, 7 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 (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 "components/gcm_driver/instance_id/instance_id_driver.h" 12 #include "components/gcm_driver/instance_id/instance_id_driver.h"
12 13
13 namespace instance_id { 14 namespace instance_id {
14 15
16 // static
17 bool InstanceIDProfileService::IsInstanceIDEnabled(Profile* profile) {
18 // Instance ID depends on GCM which has to been enabled.
19 if (!gcm::GCMProfileService::IsGCMEnabled(profile))
20 return false;
21
22 // Enabled for trunk build.
23 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
24 if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN)
25 return true;
26
27 return InstanceIDDriver::IsInstanceIDEnabled();
28 }
29
15 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) { 30 InstanceIDProfileService::InstanceIDProfileService(Profile* profile) {
16 DCHECK(!profile->IsOffTheRecord()); 31 DCHECK(!profile->IsOffTheRecord());
17 32
18 driver_.reset(new InstanceIDDriver( 33 driver_.reset(new InstanceIDDriver(
19 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver())); 34 gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver()));
20 } 35 }
21 36
22 InstanceIDProfileService::~InstanceIDProfileService() { 37 InstanceIDProfileService::~InstanceIDProfileService() {
23 } 38 }
24 39
25 } // namespace instance_id 40 } // namespace instance_id
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/instance_id/instance_id_profile_service.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698