| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/notifier/sync_notifier_factory.h" | 5 #include "chrome/browser/sync/notifier/sync_notifier_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h" | 13 #include "chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h" |
| 14 #include "chrome/browser/sync/notifier/p2p_notifier.h" | 14 #include "chrome/browser/sync/notifier/p2p_notifier.h" |
| 15 #include "chrome/browser/sync/notifier/sync_notifier.h" | 15 #include "chrome/browser/sync/notifier/sync_notifier.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "content/public/browser/browser_thread.h" | |
| 18 #include "jingle/notifier/base/const_communicator.h" | 17 #include "jingle/notifier/base/const_communicator.h" |
| 19 #include "jingle/notifier/base/notifier_options.h" | 18 #include "jingle/notifier/base/notifier_options.h" |
| 20 #include "jingle/notifier/listener/mediator_thread_impl.h" | 19 #include "jingle/notifier/listener/mediator_thread_impl.h" |
| 21 #include "jingle/notifier/listener/talk_mediator_impl.h" | 20 #include "jingle/notifier/listener/talk_mediator_impl.h" |
| 22 #include "net/base/host_port_pair.h" | 21 #include "net/base/host_port_pair.h" |
| 23 | 22 |
| 24 using content::BrowserThread; | |
| 25 | |
| 26 namespace sync_notifier { | 23 namespace sync_notifier { |
| 27 namespace { | 24 namespace { |
| 28 | 25 |
| 29 // TODO(akalin): Figure out whether this should be a method of | 26 // TODO(akalin): Figure out whether this should be a method of |
| 30 // HostPortPair. | 27 // HostPortPair. |
| 31 net::HostPortPair StringToHostPortPair(const std::string& host_port_str, | 28 net::HostPortPair StringToHostPortPair(const std::string& host_port_str, |
| 32 uint16 default_port) { | 29 uint16 default_port) { |
| 33 std::string::size_type colon_index = host_port_str.find(':'); | 30 std::string::size_type colon_index = host_port_str.find(':'); |
| 34 if (colon_index == std::string::npos) { | 31 if (colon_index == std::string::npos) { |
| 35 return net::HostPortPair(host_port_str, default_port); | 32 return net::HostPortPair(host_port_str, default_port); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 invalidation_version_tracker, | 122 invalidation_version_tracker, |
| 126 const CommandLine& command_line) | 123 const CommandLine& command_line) |
| 127 : client_info_(client_info), | 124 : client_info_(client_info), |
| 128 request_context_getter_(request_context_getter), | 125 request_context_getter_(request_context_getter), |
| 129 initial_max_invalidation_versions_( | 126 initial_max_invalidation_versions_( |
| 130 invalidation_version_tracker.get() ? | 127 invalidation_version_tracker.get() ? |
| 131 invalidation_version_tracker->GetAllMaxVersions() : | 128 invalidation_version_tracker->GetAllMaxVersions() : |
| 132 InvalidationVersionMap()), | 129 InvalidationVersionMap()), |
| 133 invalidation_version_tracker_(invalidation_version_tracker), | 130 invalidation_version_tracker_(invalidation_version_tracker), |
| 134 command_line_(command_line) { | 131 command_line_(command_line) { |
| 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 136 } | 132 } |
| 137 | 133 |
| 138 SyncNotifierFactory::~SyncNotifierFactory() { | 134 SyncNotifierFactory::~SyncNotifierFactory() { |
| 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 140 } | 135 } |
| 141 | 136 |
| 142 SyncNotifier* SyncNotifierFactory::CreateSyncNotifier() { | 137 SyncNotifier* SyncNotifierFactory::CreateSyncNotifier() { |
| 143 return CreateDefaultSyncNotifier(command_line_, | 138 return CreateDefaultSyncNotifier(command_line_, |
| 144 request_context_getter_, | 139 request_context_getter_, |
| 145 initial_max_invalidation_versions_, | 140 initial_max_invalidation_versions_, |
| 146 invalidation_version_tracker_, | 141 invalidation_version_tracker_, |
| 147 client_info_); | 142 client_info_); |
| 148 } | 143 } |
| 149 } // namespace sync_notifier | 144 } // namespace sync_notifier |
| OLD | NEW |