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

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

Issue 261853012: Componentize GCM Part 1: create GCM component and move some files over (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove os_crypt dependency from google_apis/gcm Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_service.h" 5 #include "chrome/browser/services/gcm/gcm_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "chrome/browser/services/gcm/gcm_app_handler.h"
17 #include "chrome/browser/services/gcm/gcm_client_factory.h"
18 #include "chrome/common/chrome_version_info.h" 16 #include "chrome/common/chrome_version_info.h"
17 #include "components/gcm/gcm_app_handler.h"
18 #include "components/gcm/gcm_client_factory.h"
19 #include "components/gcm/system_encryptor.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "google_apis/gaia/oauth2_token_service.h" 21 #include "google_apis/gaia/oauth2_token_service.h"
21 #include "google_apis/gcm/protocol/android_checkin.pb.h" 22 #include "google_apis/gcm/protocol/android_checkin.pb.h"
22 #include "net/url_request/url_request_context_getter.h" 23 #include "net/url_request/url_request_context_getter.h"
23 24
24 namespace gcm { 25 namespace gcm {
25 26
26 namespace { 27 namespace {
27 28
28 checkin_proto::ChromeBuildProto_Platform GetPlatform() { 29 checkin_proto::ChromeBuildProto_Platform GetPlatform() {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 186 }
186 187
187 void GCMService::IOWorker::Initialize( 188 void GCMService::IOWorker::Initialize(
188 scoped_ptr<GCMClientFactory> gcm_client_factory, 189 scoped_ptr<GCMClientFactory> gcm_client_factory,
189 const base::FilePath& store_path, 190 const base::FilePath& store_path,
190 const std::vector<std::string>& account_ids, 191 const std::vector<std::string>& account_ids,
191 const scoped_refptr<net::URLRequestContextGetter>& 192 const scoped_refptr<net::URLRequestContextGetter>&
192 url_request_context_getter) { 193 url_request_context_getter) {
193 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 194 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
194 195
195 gcm_client_ = gcm_client_factory->BuildInstance().Pass(); 196 gcm_client_ = gcm_client_factory->BuildInstance(
197 make_scoped_ptr<Encryptor>(new SystemEncryptor)).Pass();
196 198
197 checkin_proto::ChromeBuildProto chrome_build_proto; 199 checkin_proto::ChromeBuildProto chrome_build_proto;
198 chrome_build_proto.set_platform(GetPlatform()); 200 chrome_build_proto.set_platform(GetPlatform());
199 chrome_build_proto.set_chrome_version(GetVersion()); 201 chrome_build_proto.set_chrome_version(GetVersion());
200 chrome_build_proto.set_channel(GetChannel()); 202 chrome_build_proto.set_channel(GetChannel());
201 203
202 scoped_refptr<base::SequencedWorkerPool> worker_pool( 204 scoped_refptr<base::SequencedWorkerPool> worker_pool(
203 content::BrowserThread::GetBlockingPool()); 205 content::BrowserThread::GetBlockingPool());
204 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 206 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
205 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 207 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second; 843 return iter == app_handlers_.end() ? &default_app_handler_ : iter->second;
842 } 844 }
843 845
844 void GCMService::GetGCMStatisticsFinished( 846 void GCMService::GetGCMStatisticsFinished(
845 GCMClient::GCMStatistics stats) { 847 GCMClient::GCMStatistics stats) {
846 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 848 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
847 request_gcm_statistics_callback_.Run(stats); 849 request_gcm_statistics_callback_.Run(stats);
848 } 850 }
849 851
850 } // namespace gcm 852 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698