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

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

Issue 1231613005: Hook up the Push API with GCM's new ability to own encryption keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-encryption
Patch Set: Created 5 years, 4 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) 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 <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_constants.h"
12 #include "components/gcm_driver/gcm_driver.h" 13 #include "components/gcm_driver/gcm_driver.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 14 #include "components/pref_registry/pref_registry_syncable.h"
14 15
15 #if defined(OS_ANDROID) 16 #if defined(OS_ANDROID)
17 #include "base/sequenced_task_runner.h"
18 #include "base/threading/sequenced_worker_pool.h"
16 #include "components/gcm_driver/gcm_driver_android.h" 19 #include "components/gcm_driver/gcm_driver_android.h"
20 #include "content/public/browser/browser_thread.h"
17 #else 21 #else
18 #include "base/bind.h" 22 #include "base/bind.h"
19 #include "base/files/file_path.h" 23 #include "base/files/file_path.h"
20 #include "base/memory/weak_ptr.h" 24 #include "base/memory/weak_ptr.h"
21 #include "chrome/browser/services/gcm/gcm_account_tracker.h" 25 #include "chrome/browser/services/gcm/gcm_account_tracker.h"
22 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" 26 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 27 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
24 #include "chrome/browser/signin/signin_manager_factory.h" 28 #include "chrome/browser/signin/signin_manager_factory.h"
25 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 29 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
26 #include "chrome/common/chrome_constants.h"
27 #include "components/gcm_driver/gcm_channel_status_syncer.h" 30 #include "components/gcm_driver/gcm_channel_status_syncer.h"
28 #include "components/gcm_driver/gcm_client_factory.h" 31 #include "components/gcm_driver/gcm_client_factory.h"
29 #include "components/gcm_driver/gcm_driver_desktop.h" 32 #include "components/gcm_driver/gcm_driver_desktop.h"
30 #include "components/signin/core/browser/profile_identity_provider.h" 33 #include "components/signin/core/browser/profile_identity_provider.h"
31 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
32 #include "google_apis/gaia/account_tracker.h" 35 #include "google_apis/gaia/account_tracker.h"
33 #include "google_apis/gaia/identity_provider.h" 36 #include "google_apis/gaia/identity_provider.h"
34 #include "net/url_request/url_request_context_getter.h" 37 #include "net/url_request/url_request_context_getter.h"
35 #endif 38 #endif
36 39
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 << debug_instance->profile_->GetStartTime().ToInternalValue() 149 << debug_instance->profile_->GetStartTime().ToInternalValue()
147 << ", new profile: " << profile << " " 150 << ", new profile: " << profile << " "
148 << profile->GetDebugName() << " " 151 << profile->GetDebugName() << " "
149 << profile->GetProfileType() << " " 152 << profile->GetProfileType() << " "
150 << profile->IsSupervised() << " " 153 << profile->IsSupervised() << " "
151 << profile->IsNewProfile() << " " 154 << profile->IsNewProfile() << " "
152 << profile->GetStartTime().ToInternalValue(); 155 << profile->GetStartTime().ToInternalValue();
153 } 156 }
154 debug_instance = this; 157 debug_instance = this;
155 158
156 driver_.reset(new GCMDriverAndroid); 159 scoped_refptr<base::SequencedWorkerPool> worker_pool(
160 content::BrowserThread::GetBlockingPool());
161 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
162 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
163 worker_pool->GetSequenceToken(),
164 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
165
166 driver_.reset(new GCMDriverAndroid(
167 profile_->GetPath().Append(chrome::kGCMStoreDirname),
168 blocking_task_runner));
157 } 169 }
158 #else 170 #else
159 GCMProfileService::GCMProfileService( 171 GCMProfileService::GCMProfileService(
160 Profile* profile, 172 Profile* profile,
161 scoped_ptr<GCMClientFactory> gcm_client_factory) 173 scoped_ptr<GCMClientFactory> gcm_client_factory)
162 : profile_(profile) { 174 : profile_(profile) {
163 DCHECK(!profile->IsOffTheRecord()); 175 DCHECK(!profile->IsOffTheRecord());
164 176
165 driver_ = CreateGCMDriverDesktop( 177 driver_ = CreateGCMDriverDesktop(
166 gcm_client_factory.Pass(), 178 gcm_client_factory.Pass(),
(...skipping 27 matching lines...) Expand all
194 206
195 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 207 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
196 driver_.reset(driver); 208 driver_.reset(driver);
197 #if !defined(OS_ANDROID) 209 #if !defined(OS_ANDROID)
198 if (identity_observer_) 210 if (identity_observer_)
199 identity_observer_.reset(new IdentityObserver(profile_, driver)); 211 identity_observer_.reset(new IdentityObserver(profile_, driver));
200 #endif // !defined(OS_ANDROID) 212 #endif // !defined(OS_ANDROID)
201 } 213 }
202 214
203 } // namespace gcm 215 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/fake_gcm_profile_service.cc ('k') | chrome/test/data/push_messaging/push_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698