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

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

Issue 642023004: Standardize usage of virtual/override/final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « sync/tools/sync_client.cc ('k') | sync/util/test_unrecoverable_error_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const char kEmailSwitch[] = "email"; 45 const char kEmailSwitch[] = "email";
46 const char kTokenSwitch[] = "token"; 46 const char kTokenSwitch[] = "token";
47 const char kHostPortSwitch[] = "host-port"; 47 const char kHostPortSwitch[] = "host-port";
48 const char kTrySslTcpFirstSwitch[] = "try-ssltcp-first"; 48 const char kTrySslTcpFirstSwitch[] = "try-ssltcp-first";
49 const char kAllowInsecureConnectionSwitch[] = "allow-insecure-connection"; 49 const char kAllowInsecureConnectionSwitch[] = "allow-insecure-connection";
50 50
51 // Class to print received notifications events. 51 // Class to print received notifications events.
52 class NotificationPrinter : public InvalidationHandler { 52 class NotificationPrinter : public InvalidationHandler {
53 public: 53 public:
54 NotificationPrinter() {} 54 NotificationPrinter() {}
55 virtual ~NotificationPrinter() {} 55 ~NotificationPrinter() override {}
56 56
57 virtual void OnInvalidatorStateChange(InvalidatorState state) override { 57 void OnInvalidatorStateChange(InvalidatorState state) override {
58 LOG(INFO) << "Invalidator state changed to " 58 LOG(INFO) << "Invalidator state changed to "
59 << InvalidatorStateToString(state); 59 << InvalidatorStateToString(state);
60 } 60 }
61 61
62 virtual void OnIncomingInvalidation( 62 void OnIncomingInvalidation(
63 const ObjectIdInvalidationMap& invalidation_map) override { 63 const ObjectIdInvalidationMap& invalidation_map) override {
64 ObjectIdSet ids = invalidation_map.GetObjectIds(); 64 ObjectIdSet ids = invalidation_map.GetObjectIds();
65 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { 65 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
66 LOG(INFO) << "Remote invalidation: " 66 LOG(INFO) << "Remote invalidation: "
67 << invalidation_map.ToString(); 67 << invalidation_map.ToString();
68 } 68 }
69 } 69 }
70 70
71 virtual std::string GetOwnerName() const override { 71 std::string GetOwnerName() const override { return "NotificationPrinter"; }
72 return "NotificationPrinter";
73 }
74 72
75 private: 73 private:
76 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); 74 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter);
77 }; 75 };
78 76
79 // Needed to use a real host resolver. 77 // Needed to use a real host resolver.
80 class MyTestURLRequestContext : public net::TestURLRequestContext { 78 class MyTestURLRequestContext : public net::TestURLRequestContext {
81 public: 79 public:
82 MyTestURLRequestContext() : TestURLRequestContext(true) { 80 MyTestURLRequestContext() : TestURLRequestContext(true) {
83 context_storage_.set_host_resolver( 81 context_storage_.set_host_resolver(
84 net::HostResolver::CreateDefaultResolver(NULL)); 82 net::HostResolver::CreateDefaultResolver(NULL));
85 context_storage_.set_transport_security_state( 83 context_storage_.set_transport_security_state(
86 new net::TransportSecurityState()); 84 new net::TransportSecurityState());
87 Init(); 85 Init();
88 } 86 }
89 87
90 virtual ~MyTestURLRequestContext() {} 88 ~MyTestURLRequestContext() override {}
91 }; 89 };
92 90
93 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { 91 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter {
94 public: 92 public:
95 explicit MyTestURLRequestContextGetter( 93 explicit MyTestURLRequestContextGetter(
96 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) 94 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
97 : TestURLRequestContextGetter(io_task_runner) {} 95 : TestURLRequestContextGetter(io_task_runner) {}
98 96
99 virtual net::TestURLRequestContext* GetURLRequestContext() override { 97 net::TestURLRequestContext* GetURLRequestContext() override {
100 // Construct |context_| lazily so it gets constructed on the right 98 // Construct |context_| lazily so it gets constructed on the right
101 // thread (the IO thread). 99 // thread (the IO thread).
102 if (!context_) 100 if (!context_)
103 context_.reset(new MyTestURLRequestContext()); 101 context_.reset(new MyTestURLRequestContext());
104 return context_.get(); 102 return context_.get();
105 } 103 }
106 104
107 private: 105 private:
108 virtual ~MyTestURLRequestContextGetter() {} 106 ~MyTestURLRequestContextGetter() override {}
109 107
110 scoped_ptr<MyTestURLRequestContext> context_; 108 scoped_ptr<MyTestURLRequestContext> context_;
111 }; 109 };
112 110
113 notifier::NotifierOptions ParseNotifierOptions( 111 notifier::NotifierOptions ParseNotifierOptions(
114 const CommandLine& command_line, 112 const CommandLine& command_line,
115 const scoped_refptr<net::URLRequestContextGetter>& 113 const scoped_refptr<net::URLRequestContextGetter>&
116 request_context_getter) { 114 request_context_getter) {
117 notifier::NotifierOptions notifier_options; 115 notifier::NotifierOptions notifier_options;
118 notifier_options.request_context_getter = request_context_getter; 116 notifier_options.request_context_getter = request_context_getter;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 io_thread.Stop(); 210 io_thread.Stop();
213 return 0; 211 return 0;
214 } 212 }
215 213
216 } // namespace 214 } // namespace
217 } // namespace syncer 215 } // namespace syncer
218 216
219 int main(int argc, char* argv[]) { 217 int main(int argc, char* argv[]) {
220 return syncer::SyncListenNotificationsMain(argc, argv); 218 return syncer::SyncListenNotificationsMain(argc, argv);
221 } 219 }
OLDNEW
« no previous file with comments | « sync/tools/sync_client.cc ('k') | sync/util/test_unrecoverable_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698