Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
|
jianli
2014/04/09 23:36:58
2014
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "google_apis/gcm/engine/gcm_internals_builder.h" | |
| 6 | |
| 7 #include "base/files/file_path.h" | |
| 8 #include "base/sequenced_task_runner.h" | |
| 9 #include "base/time/default_clock.h" | |
| 10 #include "components/os_crypt/os_crypt.h" | |
| 11 #include "google_apis/gcm/engine/connection_factory_impl.h" | |
| 12 #include "google_apis/gcm/engine/gcm_store_impl.h" | |
| 13 #include "google_apis/gcm/engine/mcs_client.h" | |
| 14 #include "net/http/http_network_session.h" | |
| 15 #include "url/gurl.h" | |
| 16 | |
| 17 namespace gcm { | |
| 18 | |
| 19 GCMInternalsBuilder::GCMInternalsBuilder() : testing_(false) {} | |
| 20 GCMInternalsBuilder::~GCMInternalsBuilder() {} | |
|
jianli
2014/04/09 23:36:58
nit: empty line above
| |
| 21 | |
| 22 scoped_ptr<base::Clock> GCMInternalsBuilder::BuildClock() { | |
| 23 return make_scoped_ptr<base::Clock>(new base::DefaultClock()); | |
| 24 } | |
| 25 | |
| 26 scoped_ptr<GCMStore> GCMInternalsBuilder::BuildGCMStore( | |
| 27 const base::FilePath& path, | |
| 28 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { | |
| 29 #if defined(OS_MACOSX) | |
| 30 OSCrypt::UseMockKeychain(testing_); | |
| 31 #endif | |
| 32 return make_scoped_ptr<GCMStore>( | |
| 33 new GCMStoreImpl(path, blocking_task_runner)); | |
| 34 } | |
| 35 | |
| 36 scoped_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient( | |
| 37 const std::string& version, | |
| 38 base::Clock* clock, | |
| 39 ConnectionFactory* connection_factory, | |
| 40 GCMStore* gcm_store) { | |
| 41 return make_scoped_ptr<MCSClient>( | |
| 42 new MCSClient(version, | |
| 43 clock, | |
| 44 connection_factory, | |
| 45 gcm_store)); | |
| 46 } | |
| 47 | |
| 48 scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory( | |
| 49 const std::vector<GURL>& endpoints, | |
| 50 const net::BackoffEntry::Policy& backoff_policy, | |
| 51 scoped_refptr<net::HttpNetworkSession> network_session, | |
| 52 net::NetLog* net_log) { | |
| 53 return make_scoped_ptr<ConnectionFactory>( | |
| 54 new ConnectionFactoryImpl(endpoints, | |
| 55 backoff_policy, | |
| 56 network_session, | |
| 57 net_log)); | |
| 58 } | |
| 59 | |
| 60 void GCMInternalsBuilder::SetUpForTesting() { | |
| 61 testing_ = true; | |
| 62 } | |
| 63 | |
| 64 } // namespace gcm | |
| OLD | NEW |