| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/session/connection_status.h" | 5 #include "blimp/client/core/session/connection_status.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 | 8 |
| 9 namespace blimp { | 9 namespace blimp { |
| 10 namespace client { | 10 namespace client { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 base::WeakPtr<ConnectionStatus> ConnectionStatus::GetWeakPtr() { | 32 base::WeakPtr<ConnectionStatus> ConnectionStatus::GetWeakPtr() { |
| 33 return weak_factory_.GetWeakPtr(); | 33 return weak_factory_.GetWeakPtr(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ConnectionStatus::OnConnected() { | 36 void ConnectionStatus::OnConnected() { |
| 37 is_connected_ = true; | 37 is_connected_ = true; |
| 38 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", true); | 38 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", true); |
| 39 FOR_EACH_OBSERVER(NetworkEventObserver, connection_observers_, OnConnected()); | 39 for (auto& observer : connection_observers_) |
| 40 observer.OnConnected(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void ConnectionStatus::OnDisconnected(int result) { | 43 void ConnectionStatus::OnDisconnected(int result) { |
| 43 is_connected_ = false; | 44 is_connected_ = false; |
| 44 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", false); | 45 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", false); |
| 45 FOR_EACH_OBSERVER(NetworkEventObserver, connection_observers_, | 46 for (auto& observer : connection_observers_) |
| 46 OnDisconnected(result)); | 47 observer.OnDisconnected(result); |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace client | 50 } // namespace client |
| 50 } // namespace blimp | 51 } // namespace blimp |
| OLD | NEW |