| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "extensions/browser/api/cast_channel/cast_message_util.h" | 9 #include "extensions/browser/api/cast_channel/cast_message_util.h" |
| 10 #include "extensions/browser/api/cast_channel/cast_socket.h" | 10 #include "extensions/browser/api/cast_channel/cast_socket.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // static | 61 // static |
| 62 CastMessage KeepAliveDelegate::CreateKeepAliveMessage( | 62 CastMessage KeepAliveDelegate::CreateKeepAliveMessage( |
| 63 const char* message_type) { | 63 const char* message_type) { |
| 64 CastMessage output; | 64 CastMessage output; |
| 65 output.set_protocol_version(CastMessage::CASTV2_1_0); | 65 output.set_protocol_version(CastMessage::CASTV2_1_0); |
| 66 output.set_source_id(kPingSenderId); | 66 output.set_source_id(kPingSenderId); |
| 67 output.set_destination_id(kPingReceiverId); | 67 output.set_destination_id(kPingReceiverId); |
| 68 output.set_namespace_(kHeartbeatNamespace); | 68 output.set_namespace_(kHeartbeatNamespace); |
| 69 base::DictionaryValue type_dict; | 69 base::DictionaryValue type_dict; |
| 70 type_dict.SetString(kTypeNodeId, message_type); | 70 type_dict.SetString(kTypeNodeId, message_type); |
| 71 if (!base::JSONWriter::Write(&type_dict, output.mutable_payload_utf8())) { | 71 if (!base::JSONWriter::Write(type_dict, output.mutable_payload_utf8())) { |
| 72 LOG(ERROR) << "Failed to serialize dictionary."; | 72 LOG(ERROR) << "Failed to serialize dictionary."; |
| 73 return output; | 73 return output; |
| 74 } | 74 } |
| 75 output.set_payload_type( | 75 output.set_payload_type( |
| 76 CastMessage::PayloadType::CastMessage_PayloadType_STRING); | 76 CastMessage::PayloadType::CastMessage_PayloadType_STRING); |
| 77 return output; | 77 return output; |
| 78 } | 78 } |
| 79 | 79 |
| 80 KeepAliveDelegate::KeepAliveDelegate( | 80 KeepAliveDelegate::KeepAliveDelegate( |
| 81 CastSocket* socket, | 81 CastSocket* socket, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 if (started_) { | 195 if (started_) { |
| 196 started_ = false; | 196 started_ = false; |
| 197 ping_timer_->Stop(); | 197 ping_timer_->Stop(); |
| 198 liveness_timer_->Stop(); | 198 liveness_timer_->Stop(); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace cast_channel | 202 } // namespace cast_channel |
| 203 } // namespace core_api | 203 } // namespace core_api |
| 204 } // namespace extensions | 204 } // namespace extensions |
| OLD | NEW |