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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service.cc

Issue 310973002: Move GCMClient related files to gcm_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/gcm_profile_service.h" 5 #include "chrome/browser/services/gcm/gcm_profile_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 24 matching lines...) Expand all
35 35
36 // static 36 // static
37 void GCMProfileService::RegisterProfilePrefs( 37 void GCMProfileService::RegisterProfilePrefs(
38 user_prefs::PrefRegistrySyncable* registry) { 38 user_prefs::PrefRegistrySyncable* registry) {
39 registry->RegisterBooleanPref( 39 registry->RegisterBooleanPref(
40 prefs::kGCMChannelEnabled, 40 prefs::kGCMChannelEnabled,
41 true, 41 true,
42 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 42 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
43 } 43 }
44 44
45 #if defined(OS_ANDROID)
46 GCMProfileService::GCMProfileService(Profile* profile)
47 : profile_(profile) {
48 DCHECK(!profile->IsOffTheRecord());
49
50 driver_.reset(new GCMDriverAndroid);
51 }
52 #else
45 GCMProfileService::GCMProfileService( 53 GCMProfileService::GCMProfileService(
46 Profile* profile, 54 Profile* profile,
47 scoped_ptr<GCMClientFactory> gcm_client_factory) 55 scoped_ptr<GCMClientFactory> gcm_client_factory)
48 : profile_(profile) { 56 : profile_(profile) {
49 DCHECK(!profile->IsOffTheRecord()); 57 DCHECK(!profile->IsOffTheRecord());
50 58
51 #if defined(OS_ANDROID)
52 driver_.reset(new GCMDriverAndroid);
53 #else
54 driver_ = CreateGCMDriverDesktop( 59 driver_ = CreateGCMDriverDesktop(
55 gcm_client_factory.Pass(), 60 gcm_client_factory.Pass(),
56 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( 61 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
57 SigninManagerFactory::GetForProfile(profile_), 62 SigninManagerFactory::GetForProfile(profile_),
58 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), 63 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
59 LoginUIServiceFactory::GetForProfile(profile_))), 64 LoginUIServiceFactory::GetForProfile(profile_))),
60 profile_->GetPath().Append(chrome::kGCMStoreDirname), 65 profile_->GetPath().Append(chrome::kGCMStoreDirname),
61 profile_->GetRequestContext()); 66 profile_->GetRequestContext());
62 #endif
63 } 67 }
68 #endif // defined(OS_ANDROID)
64 69
65 GCMProfileService::GCMProfileService() : profile_(NULL) { 70 GCMProfileService::GCMProfileService() : profile_(NULL) {
66 } 71 }
67 72
68 GCMProfileService::~GCMProfileService() { 73 GCMProfileService::~GCMProfileService() {
69 } 74 }
70 75
71 void GCMProfileService::AddAppHandler(const std::string& app_id, 76 void GCMProfileService::AddAppHandler(const std::string& app_id,
72 GCMAppHandler* handler) { 77 GCMAppHandler* handler) {
73 if (driver_) 78 if (driver_)
(...skipping 17 matching lines...) Expand all
91 driver_->Shutdown(); 96 driver_->Shutdown();
92 driver_.reset(); 97 driver_.reset();
93 } 98 }
94 } 99 }
95 100
96 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 101 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
97 driver_.reset(driver); 102 driver_.reset(driver);
98 } 103 }
99 104
100 } // namespace gcm 105 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service.h ('k') | chrome/browser/services/gcm/gcm_profile_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698