OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ | 5 #ifndef COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ |
6 #define COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ | 6 #define COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "components/invalidation/impl/sync_system_resources.h" | 15 #include "components/invalidation/impl/sync_system_resources.h" |
14 #include "components/invalidation/public/invalidation_export.h" | 16 #include "components/invalidation/public/invalidation_export.h" |
15 #include "jingle/notifier/listener/push_client_observer.h" | 17 #include "jingle/notifier/listener/push_client_observer.h" |
16 | 18 |
17 namespace notifier { | 19 namespace notifier { |
18 class PushClient; | 20 class PushClient; |
19 } // namespace notifier | 21 } // namespace notifier |
20 | 22 |
21 namespace syncer { | 23 namespace syncer { |
(...skipping 25 matching lines...) Expand all Loading... |
47 | 49 |
48 // notifier::PushClient::Observer implementation. | 50 // notifier::PushClient::Observer implementation. |
49 void OnNotificationsEnabled() override; | 51 void OnNotificationsEnabled() override; |
50 void OnNotificationsDisabled( | 52 void OnNotificationsDisabled( |
51 notifier::NotificationsDisabledReason reason) override; | 53 notifier::NotificationsDisabledReason reason) override; |
52 void OnIncomingNotification( | 54 void OnIncomingNotification( |
53 const notifier::Notification& notification) override; | 55 const notifier::Notification& notification) override; |
54 | 56 |
55 const std::string& GetServiceContextForTest() const; | 57 const std::string& GetServiceContextForTest() const; |
56 | 58 |
57 int64 GetSchedulingHashForTest() const; | 59 int64_t GetSchedulingHashForTest() const; |
58 | 60 |
59 static std::string EncodeMessageForTest(const std::string& message, | 61 static std::string EncodeMessageForTest(const std::string& message, |
60 const std::string& service_context, | 62 const std::string& service_context, |
61 int64 scheduling_hash); | 63 int64_t scheduling_hash); |
62 | 64 |
63 static bool DecodeMessageForTest(const std::string& notification, | 65 static bool DecodeMessageForTest(const std::string& notification, |
64 std::string* message, | 66 std::string* message, |
65 std::string* service_context, | 67 std::string* service_context, |
66 int64* scheduling_hash); | 68 int64_t* scheduling_hash); |
67 | 69 |
68 private: | 70 private: |
69 static void EncodeMessage(std::string* encoded_message, | 71 static void EncodeMessage(std::string* encoded_message, |
70 const std::string& message, | 72 const std::string& message, |
71 const std::string& service_context, | 73 const std::string& service_context, |
72 int64 scheduling_hash); | 74 int64_t scheduling_hash); |
73 static bool DecodeMessage(const std::string& data, | 75 static bool DecodeMessage(const std::string& data, |
74 std::string* message, | 76 std::string* message, |
75 std::string* service_context, | 77 std::string* service_context, |
76 int64* scheduling_hash); | 78 int64_t* scheduling_hash); |
77 scoped_ptr<base::DictionaryValue> CollectDebugData() const; | 79 scoped_ptr<base::DictionaryValue> CollectDebugData() const; |
78 | 80 |
79 scoped_ptr<notifier::PushClient> push_client_; | 81 scoped_ptr<notifier::PushClient> push_client_; |
80 std::string service_context_; | 82 std::string service_context_; |
81 int64 scheduling_hash_; | 83 int64_t scheduling_hash_; |
82 | 84 |
83 // This count is saved for displaying statatistics. | 85 // This count is saved for displaying statatistics. |
84 int sent_messages_count_; | 86 int sent_messages_count_; |
85 | 87 |
86 DISALLOW_COPY_AND_ASSIGN(PushClientChannel); | 88 DISALLOW_COPY_AND_ASSIGN(PushClientChannel); |
87 }; | 89 }; |
88 | 90 |
89 } // namespace syncer | 91 } // namespace syncer |
90 | 92 |
91 #endif // COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ | 93 #endif // COMPONENTS_INVALIDATION_IMPL_PUSH_CLIENT_CHANNEL_H_ |
OLD | NEW |