OLD | NEW |
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 "components/invalidation/p2p_invalidation_service.h" | 5 #include "components/invalidation/p2p_invalidation_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "components/invalidation/invalidation_service_util.h" | 8 #include "components/invalidation/invalidation_service_util.h" |
9 #include "components/invalidation/p2p_invalidator.h" | 9 #include "components/invalidation/p2p_invalidator.h" |
10 #include "google_apis/gaia/identity_provider.h" | 10 #include "google_apis/gaia/identity_provider.h" |
11 #include "jingle/notifier/base/notifier_options.h" | 11 #include "jingle/notifier/base/notifier_options.h" |
12 #include "jingle/notifier/listener/push_client.h" | 12 #include "jingle/notifier/listener/push_client.h" |
13 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 class URLRequestContextGetter; | 16 class URLRequestContextGetter; |
17 } | 17 } |
18 | 18 |
19 namespace invalidation { | 19 namespace invalidation { |
20 | 20 |
21 P2PInvalidationService::P2PInvalidationService( | 21 P2PInvalidationService::P2PInvalidationService( |
22 scoped_ptr<IdentityProvider> identity_provider, | 22 scoped_ptr<IdentityProvider> identity_provider, |
23 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 23 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
24 syncer::P2PNotificationTarget notification_target) | 24 syncer::P2PNotificationTarget notification_target) |
25 : identity_provider_(identity_provider.Pass()) { | 25 : identity_provider_(identity_provider.Pass()) { |
26 notifier::NotifierOptions notifier_options = | 26 notifier::NotifierOptions notifier_options = |
27 ParseNotifierOptions(*CommandLine::ForCurrentProcess()); | 27 ParseNotifierOptions(*base::CommandLine::ForCurrentProcess()); |
28 notifier_options.request_context_getter = request_context; | 28 notifier_options.request_context_getter = request_context; |
29 invalidator_id_ = GenerateInvalidatorClientId(); | 29 invalidator_id_ = GenerateInvalidatorClientId(); |
30 invalidator_.reset(new syncer::P2PInvalidator( | 30 invalidator_.reset(new syncer::P2PInvalidator( |
31 notifier::PushClient::CreateDefault(notifier_options), | 31 notifier::PushClient::CreateDefault(notifier_options), |
32 invalidator_id_, | 32 invalidator_id_, |
33 notification_target)); | 33 notification_target)); |
34 } | 34 } |
35 | 35 |
36 P2PInvalidationService::~P2PInvalidationService() { | 36 P2PInvalidationService::~P2PInvalidationService() { |
37 } | 37 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 base::Callback<void(const base::DictionaryValue&)> caller) const { | 78 base::Callback<void(const base::DictionaryValue&)> caller) const { |
79 base::DictionaryValue value; | 79 base::DictionaryValue value; |
80 caller.Run(value); | 80 caller.Run(value); |
81 } | 81 } |
82 | 82 |
83 IdentityProvider* P2PInvalidationService::GetIdentityProvider() { | 83 IdentityProvider* P2PInvalidationService::GetIdentityProvider() { |
84 return identity_provider_.get(); | 84 return identity_provider_.get(); |
85 } | 85 } |
86 | 86 |
87 } // namespace invalidation | 87 } // namespace invalidation |
OLD | NEW |