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 #include "extensions/browser/api/cast_channel/logger.h" | 5 #include "extensions/browser/api/cast_channel/logger.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 Logger::~Logger() { | 137 Logger::~Logger() { |
138 } | 138 } |
139 | 139 |
140 void Logger::LogNewSocketEvent(const CastSocket& cast_socket) { | 140 void Logger::LogNewSocketEvent(const CastSocket& cast_socket) { |
141 DCHECK(thread_checker_.CalledOnValidThread()); | 141 DCHECK(thread_checker_.CalledOnValidThread()); |
142 | 142 |
143 SocketEvent event = CreateEvent(proto::CAST_SOCKET_CREATED); | 143 SocketEvent event = CreateEvent(proto::CAST_SOCKET_CREATED); |
144 AggregatedSocketEvent& aggregated_socket_event = | 144 AggregatedSocketEvent& aggregated_socket_event = |
145 LogSocketEvent(cast_socket.id(), event); | 145 LogSocketEvent(cast_socket.id(), event); |
146 | 146 |
147 const net::IPAddressNumber& ip = cast_socket.ip_endpoint().address().bytes(); | 147 const net::IPAddress& ip = cast_socket.ip_endpoint().address(); |
148 aggregated_socket_event.set_endpoint_id(ip.back()); | 148 DCHECK(ip.IsValid()); |
| 149 aggregated_socket_event.set_endpoint_id(ip.bytes().back()); |
149 aggregated_socket_event.set_channel_auth_type(cast_socket.channel_auth() == | 150 aggregated_socket_event.set_channel_auth_type(cast_socket.channel_auth() == |
150 CHANNEL_AUTH_TYPE_SSL | 151 CHANNEL_AUTH_TYPE_SSL |
151 ? proto::SSL | 152 ? proto::SSL |
152 : proto::SSL_VERIFIED); | 153 : proto::SSL_VERIFIED); |
153 } | 154 } |
154 | 155 |
155 void Logger::LogSocketEvent(int channel_id, EventType event_type) { | 156 void Logger::LogSocketEvent(int channel_id, EventType event_type) { |
156 DCHECK(thread_checker_.CalledOnValidThread()); | 157 DCHECK(thread_checker_.CalledOnValidThread()); |
157 | 158 |
158 LogSocketEventWithDetails(channel_id, event_type, std::string()); | 159 LogSocketEventWithDetails(channel_id, event_type, std::string()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 if (it != aggregated_socket_events_.end()) { | 358 if (it != aggregated_socket_events_.end()) { |
358 return it->second->last_errors; | 359 return it->second->last_errors; |
359 } else { | 360 } else { |
360 return LastErrors(); | 361 return LastErrors(); |
361 } | 362 } |
362 } | 363 } |
363 | 364 |
364 } // namespace cast_channel | 365 } // namespace cast_channel |
365 } // namespace api | 366 } // namespace api |
366 } // namespace extensions | 367 } // namespace extensions |
OLD | NEW |