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

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

Issue 10837214: Refactor ModelTypePayloadMap and ObjectIdPayloadMap to StateMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « sync/test/engine/syncer_command_test.h ('k') | no next file » | 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/base64.h" 10 #include "base/base64.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "jingle/notifier/base/notification_method.h" 19 #include "jingle/notifier/base/notification_method.h"
20 #include "jingle/notifier/base/notifier_options.h" 20 #include "jingle/notifier/base/notifier_options.h"
21 #include "net/base/host_port_pair.h" 21 #include "net/base/host_port_pair.h"
22 #include "net/base/host_resolver.h" 22 #include "net/base/host_resolver.h"
23 #include "net/base/network_change_notifier.h" 23 #include "net/base/network_change_notifier.h"
24 #include "net/base/transport_security_state.h" 24 #include "net/base/transport_security_state.h"
25 #include "net/url_request/url_request_test_util.h" 25 #include "net/url_request/url_request_test_util.h"
26 #include "sync/internal_api/public/base/model_type.h" 26 #include "sync/internal_api/public/base/model_type.h"
27 #include "sync/internal_api/public/base/model_type_payload_map.h" 27 #include "sync/internal_api/public/base/model_type_state_map.h"
28 #include "sync/notifier/invalidation_state_tracker.h" 28 #include "sync/notifier/invalidation_state_tracker.h"
29 #include "sync/notifier/invalidation_util.h" 29 #include "sync/notifier/invalidation_util.h"
30 #include "sync/notifier/sync_notifier.h" 30 #include "sync/notifier/sync_notifier.h"
31 #include "sync/notifier/sync_notifier_factory.h" 31 #include "sync/notifier/sync_notifier_factory.h"
32 #include "sync/notifier/sync_notifier_observer.h" 32 #include "sync/notifier/sync_notifier_observer.h"
33 33
34 #if defined(OS_MACOSX) 34 #if defined(OS_MACOSX)
35 #include "base/mac/scoped_nsautorelease_pool.h" 35 #include "base/mac/scoped_nsautorelease_pool.h"
36 #endif 36 #endif
37 37
(...skipping 20 matching lines...) Expand all
58 LOG(INFO) << "Notifications enabled"; 58 LOG(INFO) << "Notifications enabled";
59 } 59 }
60 60
61 virtual void OnNotificationsDisabled( 61 virtual void OnNotificationsDisabled(
62 NotificationsDisabledReason reason) OVERRIDE { 62 NotificationsDisabledReason reason) OVERRIDE {
63 LOG(INFO) << "Notifications disabled with reason " 63 LOG(INFO) << "Notifications disabled with reason "
64 << NotificationsDisabledReasonToString(reason); 64 << NotificationsDisabledReasonToString(reason);
65 } 65 }
66 66
67 virtual void OnIncomingNotification( 67 virtual void OnIncomingNotification(
68 const ObjectIdPayloadMap& id_payloads, 68 const ObjectIdStateMap& id_state_map,
69 IncomingNotificationSource source) OVERRIDE { 69 IncomingNotificationSource source) OVERRIDE {
70 const ModelTypePayloadMap& type_payloads = 70 const ModelTypeStateMap& type_state_map =
71 ObjectIdPayloadMapToModelTypePayloadMap(id_payloads); 71 ObjectIdStateMapToModelTypeStateMap(id_state_map);
72 for (ModelTypePayloadMap::const_iterator it = 72 for (ModelTypeStateMap::const_iterator it = type_state_map.begin();
73 type_payloads.begin(); it != type_payloads.end(); ++it) { 73 it != type_state_map.end(); ++it) {
74 LOG(INFO) << (source == REMOTE_NOTIFICATION ? "Remote" : "Local") 74 LOG(INFO) << (source == REMOTE_NOTIFICATION ? "Remote" : "Local")
75 << " Notification: type = " 75 << " Notification: type = "
76 << ModelTypeToString(it->first) 76 << ModelTypeToString(it->first)
77 << ", payload = " << it->second; 77 << ", payload = " << it->second.payload;
78 } 78 }
79 } 79 }
80 80
81 private: 81 private:
82 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); 82 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter);
83 }; 83 };
84 84
85 class NullInvalidationStateTracker 85 class NullInvalidationStateTracker
86 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, 86 : public base::SupportsWeakPtr<NullInvalidationStateTracker>,
87 public InvalidationStateTracker { 87 public InvalidationStateTracker {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 io_thread.Stop(); 255 io_thread.Stop();
256 return 0; 256 return 0;
257 } 257 }
258 258
259 } // namespace 259 } // namespace
260 } // namespace syncer 260 } // namespace syncer
261 261
262 int main(int argc, char* argv[]) { 262 int main(int argc, char* argv[]) {
263 return syncer::SyncListenNotificationsMain(argc, argv); 263 return syncer::SyncListenNotificationsMain(argc, argv);
264 } 264 }
OLDNEW
« no previous file with comments | « sync/test/engine/syncer_command_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698