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

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: Make push_messaging_service non-const 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 27 matching lines...) Expand all
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 GCMProfileService::GCMProfileService( 45 GCMProfileService::GCMProfileService(
46 Profile* profile, 46 Profile* profile,
47 scoped_ptr<GCMClientFactory> gcm_client_factory) 47 scoped_ptr<GCMClientFactory> gcm_client_factory)
48 : profile_(profile) { 48 : profile_(profile),
49 push_messaging_service_(this) {
49 DCHECK(!profile->IsOffTheRecord()); 50 DCHECK(!profile->IsOffTheRecord());
50 51
51 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
52 driver_.reset(new GCMDriverAndroid); 53 driver_.reset(new GCMDriverAndroid);
53 #else 54 #else
54 driver_ = CreateGCMDriverDesktop( 55 driver_ = CreateGCMDriverDesktop(
55 gcm_client_factory.Pass(), 56 gcm_client_factory.Pass(),
56 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( 57 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
57 SigninManagerFactory::GetForProfile(profile_), 58 SigninManagerFactory::GetForProfile(profile_),
58 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), 59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
59 LoginUIServiceFactory::GetForProfile(profile_))), 60 LoginUIServiceFactory::GetForProfile(profile_))),
60 profile_->GetPath().Append(chrome::kGCMStoreDirname), 61 profile_->GetPath().Append(chrome::kGCMStoreDirname),
61 profile_->GetRequestContext()); 62 profile_->GetRequestContext());
62 #endif 63 #endif
63 } 64 }
64 65
65 GCMProfileService::GCMProfileService() : profile_(NULL) { 66 GCMProfileService::GCMProfileService()
67 : profile_(NULL),
68 push_messaging_service_(this) {
66 } 69 }
67 70
68 GCMProfileService::~GCMProfileService() { 71 GCMProfileService::~GCMProfileService() {
69 } 72 }
70 73
71 void GCMProfileService::AddAppHandler(const std::string& app_id, 74 void GCMProfileService::AddAppHandler(const std::string& app_id,
72 GCMAppHandler* handler) { 75 GCMAppHandler* handler) {
73 if (driver_) 76 if (driver_)
74 driver_->AddAppHandler(app_id, handler); 77 driver_->AddAppHandler(app_id, handler);
75 } 78 }
(...skipping 15 matching lines...) Expand all
91 driver_->Shutdown(); 94 driver_->Shutdown();
92 driver_.reset(); 95 driver_.reset();
93 } 96 }
94 } 97 }
95 98
96 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 99 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
97 driver_.reset(driver); 100 driver_.reset(driver);
98 } 101 }
99 102
100 } // namespace gcm 103 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698