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

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

Issue 340773006: Dispatch push event to worker from PushServiceImpl#OnMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Debugging. 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 user_prefs::PrefRegistrySyncable* registry) { 96 user_prefs::PrefRegistrySyncable* registry) {
97 registry->RegisterBooleanPref( 97 registry->RegisterBooleanPref(
98 prefs::kGCMChannelEnabled, 98 prefs::kGCMChannelEnabled,
99 true, 99 true,
100 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 100 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
101 PushMessagingServiceImpl::RegisterProfilePrefs(registry); 101 PushMessagingServiceImpl::RegisterProfilePrefs(registry);
102 } 102 }
103 103
104 #if defined(OS_ANDROID) 104 #if defined(OS_ANDROID)
105 GCMProfileService::GCMProfileService(Profile* profile) 105 GCMProfileService::GCMProfileService(Profile* profile)
106 : profile_(profile), 106 : profile_(profile), push_messaging_service_(this, profile) {
107 push_messaging_service_(this, profile) {
108 DCHECK(!profile->IsOffTheRecord()); 107 DCHECK(!profile->IsOffTheRecord());
109 108
110 driver_.reset(new GCMDriverAndroid); 109 driver_.reset(new GCMDriverAndroid);
111 } 110 }
112 #else 111 #else
113 GCMProfileService::GCMProfileService( 112 GCMProfileService::GCMProfileService(
114 Profile* profile, 113 Profile* profile,
115 scoped_ptr<GCMClientFactory> gcm_client_factory) 114 scoped_ptr<GCMClientFactory> gcm_client_factory)
116 : profile_(profile), 115 : profile_(profile), push_messaging_service_(this, profile) {
117 push_messaging_service_(this, profile) {
118 DCHECK(!profile->IsOffTheRecord()); 116 DCHECK(!profile->IsOffTheRecord());
119 117
120 driver_ = CreateGCMDriverDesktop( 118 driver_ = CreateGCMDriverDesktop(
121 gcm_client_factory.Pass(), 119 gcm_client_factory.Pass(),
122 profile_->GetPath().Append(chrome::kGCMStoreDirname), 120 profile_->GetPath().Append(chrome::kGCMStoreDirname),
123 profile_->GetRequestContext()); 121 profile_->GetRequestContext());
124 122
125 identity_observer_.reset(new IdentityObserver(profile, driver_.get())); 123 identity_observer_.reset(new IdentityObserver(profile, driver_.get()));
126 } 124 }
127 #endif // defined(OS_ANDROID) 125 #endif // defined(OS_ANDROID)
128 126
129 GCMProfileService::GCMProfileService() 127 GCMProfileService::GCMProfileService()
130 : profile_(NULL), 128 : profile_(NULL), push_messaging_service_(this, NULL) {
131 push_messaging_service_(this, NULL) {
132 } 129 }
133 130
134 GCMProfileService::~GCMProfileService() { 131 GCMProfileService::~GCMProfileService() {
135 } 132 }
136 133
137 void GCMProfileService::AddAppHandler(const std::string& app_id, 134 void GCMProfileService::AddAppHandler(const std::string& app_id,
138 GCMAppHandler* handler) { 135 GCMAppHandler* handler) {
139 if (driver_) 136 if (driver_)
140 driver_->AddAppHandler(app_id, handler); 137 driver_->AddAppHandler(app_id, handler);
141 } 138 }
(...skipping 28 matching lines...) Expand all
170 return identity_observer_ ? identity_observer_->SignedInUserName() 167 return identity_observer_ ? identity_observer_->SignedInUserName()
171 : std::string(); 168 : std::string();
172 #endif // defined(OS_ANDROID) 169 #endif // defined(OS_ANDROID)
173 } 170 }
174 171
175 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 172 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
176 driver_.reset(driver); 173 driver_.reset(driver);
177 } 174 }
178 175
179 } // namespace gcm 176 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698