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

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

Issue 317823007: Hook PushMessagingMessageFilter up to GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Send failure IPC when service is NULL 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 26 matching lines...) Expand all
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) 45 #if defined(OS_ANDROID)
46 GCMProfileService::GCMProfileService(Profile* profile) 46 GCMProfileService::GCMProfileService(Profile* profile)
47 : profile_(profile) { 47 : profile_(profile),
48 push_messaging_service_(this) {
48 DCHECK(!profile->IsOffTheRecord()); 49 DCHECK(!profile->IsOffTheRecord());
49 50
50 driver_.reset(new GCMDriverAndroid); 51 driver_.reset(new GCMDriverAndroid);
51 } 52 }
52 #else 53 #else
53 GCMProfileService::GCMProfileService( 54 GCMProfileService::GCMProfileService(
54 Profile* profile, 55 Profile* profile,
55 scoped_ptr<GCMClientFactory> gcm_client_factory) 56 scoped_ptr<GCMClientFactory> gcm_client_factory)
56 : profile_(profile) { 57 : profile_(profile),
58 push_messaging_service_(this) {
57 DCHECK(!profile->IsOffTheRecord()); 59 DCHECK(!profile->IsOffTheRecord());
58 60
59 driver_ = CreateGCMDriverDesktop( 61 driver_ = CreateGCMDriverDesktop(
60 gcm_client_factory.Pass(), 62 gcm_client_factory.Pass(),
61 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( 63 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
62 SigninManagerFactory::GetForProfile(profile_), 64 SigninManagerFactory::GetForProfile(profile_),
63 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), 65 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
64 LoginUIServiceFactory::GetForProfile(profile_))), 66 LoginUIServiceFactory::GetForProfile(profile_))),
65 profile_->GetPath().Append(chrome::kGCMStoreDirname), 67 profile_->GetPath().Append(chrome::kGCMStoreDirname),
66 profile_->GetRequestContext()); 68 profile_->GetRequestContext());
67 } 69 }
68 #endif // defined(OS_ANDROID) 70 #endif // defined(OS_ANDROID)
69 71
70 GCMProfileService::GCMProfileService() : profile_(NULL) { 72 GCMProfileService::GCMProfileService()
73 : profile_(NULL),
74 push_messaging_service_(this) {
71 } 75 }
72 76
73 GCMProfileService::~GCMProfileService() { 77 GCMProfileService::~GCMProfileService() {
74 } 78 }
75 79
76 void GCMProfileService::AddAppHandler(const std::string& app_id, 80 void GCMProfileService::AddAppHandler(const std::string& app_id,
77 GCMAppHandler* handler) { 81 GCMAppHandler* handler) {
78 if (driver_) 82 if (driver_)
79 driver_->AddAppHandler(app_id, handler); 83 driver_->AddAppHandler(app_id, handler);
80 } 84 }
(...skipping 15 matching lines...) Expand all
96 driver_->Shutdown(); 100 driver_->Shutdown();
97 driver_.reset(); 101 driver_.reset();
98 } 102 }
99 } 103 }
100 104
101 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 105 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
102 driver_.reset(driver); 106 driver_.reset(driver);
103 } 107 }
104 108
105 } // namespace gcm 109 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service.h ('k') | chrome/browser/services/gcm/push_messaging_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698