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_PROXIMITY_AUTH_MESSENGER_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_MESSENGER_IMPL_H |
6 #define COMPONENTS_PROXIMITY_AUTH_MESSENGER_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_MESSENGER_IMPL_H |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 protected: | 48 protected: |
49 SecureContext* secure_context() { return secure_context_.get(); } | 49 SecureContext* secure_context() { return secure_context_.get(); } |
50 | 50 |
51 private: | 51 private: |
52 // Internal data structure to represent a pending message that either hasn't | 52 // Internal data structure to represent a pending message that either hasn't |
53 // been sent yet or is waiting for a response from the remote device. | 53 // been sent yet or is waiting for a response from the remote device. |
54 struct PendingMessage { | 54 struct PendingMessage { |
55 PendingMessage(); | 55 PendingMessage(); |
56 PendingMessage(const base::DictionaryValue& message); | 56 PendingMessage(const base::DictionaryValue& message); |
| 57 PendingMessage(const std::string& message); |
57 ~PendingMessage(); | 58 ~PendingMessage(); |
58 | 59 |
59 // The message, serialized as JSON. | 60 // The message, serialized as JSON. |
60 const std::string json_message; | 61 const std::string json_message; |
61 | 62 |
62 // The message type. This is possible to parse from the |json_message|; it's | 63 // The message type. This is possible to parse from the |json_message|; it's |
63 // stored redundantly for convenience. | 64 // stored redundantly for convenience. |
64 const std::string type; | 65 const std::string type; |
65 }; | 66 }; |
66 | 67 |
(...skipping 11 matching lines...) Expand all Loading... |
78 void HandleRemoteStatusUpdateMessage(const base::DictionaryValue& message); | 79 void HandleRemoteStatusUpdateMessage(const base::DictionaryValue& message); |
79 | 80 |
80 // Handles an incoming "decrypt_response" message, parsing and notifying | 81 // Handles an incoming "decrypt_response" message, parsing and notifying |
81 // observers of the decrypted content. | 82 // observers of the decrypted content. |
82 void HandleDecryptResponseMessage(const base::DictionaryValue& message); | 83 void HandleDecryptResponseMessage(const base::DictionaryValue& message); |
83 | 84 |
84 // Handles an incoming "unlock_response" message, notifying observers of the | 85 // Handles an incoming "unlock_response" message, notifying observers of the |
85 // response. | 86 // response. |
86 void HandleUnlockResponseMessage(const base::DictionaryValue& message); | 87 void HandleUnlockResponseMessage(const base::DictionaryValue& message); |
87 | 88 |
| 89 // For iOS, we need to poll the phone every few seconds to keep the app alive |
| 90 // in the background. This function starts the poll loop. |
| 91 void PollScreenStateForIOS(); |
| 92 |
88 // ConnectionObserver: | 93 // ConnectionObserver: |
89 void OnConnectionStatusChanged(Connection* connection, | 94 void OnConnectionStatusChanged(Connection* connection, |
90 Connection::Status old_status, | 95 Connection::Status old_status, |
91 Connection::Status new_status) override; | 96 Connection::Status new_status) override; |
92 void OnMessageReceived(const Connection& connection, | 97 void OnMessageReceived(const Connection& connection, |
93 const WireMessage& wire_message) override; | 98 const WireMessage& wire_message) override; |
94 void OnSendCompleted(const Connection& connection, | 99 void OnSendCompleted(const Connection& connection, |
95 const WireMessage& wire_message, | 100 const WireMessage& wire_message, |
96 bool success) override; | 101 bool success) override; |
97 | 102 |
(...skipping 15 matching lines...) Expand all Loading... |
113 scoped_ptr<PendingMessage> pending_message_; | 118 scoped_ptr<PendingMessage> pending_message_; |
114 | 119 |
115 base::WeakPtrFactory<MessengerImpl> weak_ptr_factory_; | 120 base::WeakPtrFactory<MessengerImpl> weak_ptr_factory_; |
116 | 121 |
117 DISALLOW_COPY_AND_ASSIGN(MessengerImpl); | 122 DISALLOW_COPY_AND_ASSIGN(MessengerImpl); |
118 }; | 123 }; |
119 | 124 |
120 } // namespace proximity_auth | 125 } // namespace proximity_auth |
121 | 126 |
122 #endif // COMPONENTS_PROXIMITY_AUTH_MESSENGER_IMPL_H | 127 #endif // COMPONENTS_PROXIMITY_AUTH_MESSENGER_IMPL_H |
OLD | NEW |