| OLD | NEW |
| 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/invalidation/p2p_invalidation_service.h" | 5 #include "chrome/browser/invalidation/p2p_invalidation_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/invalidation/invalidation_auth_provider.h" |
| 8 #include "chrome/browser/invalidation/invalidation_service_util.h" | 9 #include "chrome/browser/invalidation/invalidation_service_util.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 11 #include "jingle/notifier/base/notifier_options.h" | 12 #include "jingle/notifier/base/notifier_options.h" |
| 12 #include "jingle/notifier/listener/push_client.h" | 13 #include "jingle/notifier/listener/push_client.h" |
| 13 #include "sync/notifier/p2p_invalidator.h" | 14 #include "sync/notifier/p2p_invalidator.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 class URLRequestContextGetter; | 17 class URLRequestContextGetter; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace invalidation { | 20 namespace invalidation { |
| 20 | 21 |
| 21 P2PInvalidationService::P2PInvalidationService(Profile* profile) { | 22 P2PInvalidationService::P2PInvalidationService( |
| 23 Profile* profile, |
| 24 scoped_ptr<InvalidationAuthProvider> auth_provider) |
| 25 : auth_provider_(auth_provider.Pass()) { |
| 22 notifier::NotifierOptions notifier_options = | 26 notifier::NotifierOptions notifier_options = |
| 23 ParseNotifierOptions(*CommandLine::ForCurrentProcess()); | 27 ParseNotifierOptions(*CommandLine::ForCurrentProcess()); |
| 24 notifier_options.request_context_getter = profile->GetRequestContext(); | 28 notifier_options.request_context_getter = profile->GetRequestContext(); |
| 25 invalidator_id_ = GenerateInvalidatorClientId(); | 29 invalidator_id_ = GenerateInvalidatorClientId(); |
| 26 invalidator_.reset(new syncer::P2PInvalidator( | 30 invalidator_.reset(new syncer::P2PInvalidator( |
| 27 notifier::PushClient::CreateDefault(notifier_options), | 31 notifier::PushClient::CreateDefault(notifier_options), |
| 28 invalidator_id_, | 32 invalidator_id_, |
| 29 syncer::NOTIFY_ALL)); | 33 syncer::NOTIFY_ALL)); |
| 30 } | 34 } |
| 31 | 35 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 71 } |
| 68 | 72 |
| 69 std::string P2PInvalidationService::GetInvalidatorClientId() const { | 73 std::string P2PInvalidationService::GetInvalidatorClientId() const { |
| 70 return invalidator_id_; | 74 return invalidator_id_; |
| 71 } | 75 } |
| 72 | 76 |
| 73 InvalidationLogger* P2PInvalidationService::GetInvalidationLogger() { | 77 InvalidationLogger* P2PInvalidationService::GetInvalidationLogger() { |
| 74 return NULL; | 78 return NULL; |
| 75 } | 79 } |
| 76 | 80 |
| 81 InvalidationAuthProvider* |
| 82 P2PInvalidationService::GetInvalidationAuthProvider() { |
| 83 return auth_provider_.get(); |
| 84 } |
| 85 |
| 77 } // namespace invalidation | 86 } // namespace invalidation |
| OLD | NEW |