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

Side by Side Diff: components/sync/tools/sync_listen_notifications.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
OLDNEW
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 <cstddef> 5 #include <cstddef>
6 #include <cstdio> 6 #include <cstdio>
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 *base::CommandLine::ForCurrentProcess(); 158 *base::CommandLine::ForCurrentProcess();
159 std::string email = command_line.GetSwitchValueASCII(kEmailSwitch); 159 std::string email = command_line.GetSwitchValueASCII(kEmailSwitch);
160 std::string token = command_line.GetSwitchValueASCII(kTokenSwitch); 160 std::string token = command_line.GetSwitchValueASCII(kTokenSwitch);
161 // TODO(akalin): Write a wrapper script that gets a token for an 161 // TODO(akalin): Write a wrapper script that gets a token for an
162 // email and password and passes that in to this utility. 162 // email and password and passes that in to this utility.
163 if (email.empty() || token.empty()) { 163 if (email.empty() || token.empty()) {
164 std::printf( 164 std::printf(
165 "Usage: %s --%s=foo@bar.com --%s=token\n" 165 "Usage: %s --%s=foo@bar.com --%s=token\n"
166 "[--%s=host:port] [--%s] [--%s]\n" 166 "[--%s=host:port] [--%s] [--%s]\n"
167 "Run chrome and set a breakpoint on\n" 167 "Run chrome and set a breakpoint on\n"
168 "syncer::SyncManagerImpl::UpdateCredentials() " 168 "SyncManagerImpl::UpdateCredentials() "
169 "after logging into\n" 169 "after logging into\n"
170 "sync to get the token to pass into this utility.\n", 170 "sync to get the token to pass into this utility.\n",
171 argv[0], kEmailSwitch, kTokenSwitch, kHostPortSwitch, 171 argv[0], kEmailSwitch, kTokenSwitch, kHostPortSwitch,
172 kTrySslTcpFirstSwitch, kAllowInsecureConnectionSwitch); 172 kTrySslTcpFirstSwitch, kAllowInsecureConnectionSwitch);
173 return -1; 173 return -1;
174 } 174 }
175 175
176 // Set up objects that monitor the network. 176 // Set up objects that monitor the network.
177 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( 177 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
178 net::NetworkChangeNotifier::Create()); 178 net::NetworkChangeNotifier::Create());
179 179
180 const notifier::NotifierOptions& notifier_options = ParseNotifierOptions( 180 const notifier::NotifierOptions& notifier_options = ParseNotifierOptions(
181 command_line, new MyTestURLRequestContextGetter(io_thread.task_runner())); 181 command_line, new MyTestURLRequestContextGetter(io_thread.task_runner()));
182 syncer::NetworkChannelCreator network_channel_creator = 182 NetworkChannelCreator network_channel_creator =
183 syncer::NonBlockingInvalidator::MakePushClientChannelCreator( 183 NonBlockingInvalidator::MakePushClientChannelCreator(notifier_options);
184 notifier_options);
185 const char kClientInfo[] = "sync_listen_notifications"; 184 const char kClientInfo[] = "sync_listen_notifications";
186 NullInvalidationStateTracker null_invalidation_state_tracker; 185 NullInvalidationStateTracker null_invalidation_state_tracker;
187 std::unique_ptr<Invalidator> invalidator(new NonBlockingInvalidator( 186 std::unique_ptr<Invalidator> invalidator(new NonBlockingInvalidator(
188 network_channel_creator, base::RandBytesAsString(8), 187 network_channel_creator, base::RandBytesAsString(8),
189 null_invalidation_state_tracker.GetSavedInvalidations(), 188 null_invalidation_state_tracker.GetSavedInvalidations(),
190 null_invalidation_state_tracker.GetBootstrapData(), 189 null_invalidation_state_tracker.GetBootstrapData(),
191 &null_invalidation_state_tracker, kClientInfo, 190 &null_invalidation_state_tracker, kClientInfo,
192 notifier_options.request_context_getter)); 191 notifier_options.request_context_getter));
193 192
194 NotificationPrinter notification_printer; 193 NotificationPrinter notification_printer;
(...skipping 11 matching lines...) Expand all
206 io_thread.Stop(); 205 io_thread.Stop();
207 return 0; 206 return 0;
208 } 207 }
209 208
210 } // namespace 209 } // namespace
211 } // namespace syncer 210 } // namespace syncer
212 211
213 int main(int argc, char* argv[]) { 212 int main(int argc, char* argv[]) {
214 return syncer::SyncListenNotificationsMain(argc, argv); 213 return syncer::SyncListenNotificationsMain(argc, argv);
215 } 214 }
OLDNEW
« no previous file with comments | « components/sync/tools/sync_client.cc ('k') | components/sync_bookmarks/bookmark_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698