| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/client/plugin/pepper_network_manager.h" | 5 #include "remoting/client/plugin/pepper_network_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "ppapi/cpp/module.h" | 11 #include "ppapi/cpp/module.h" |
| 12 #include "ppapi/cpp/private/network_list_private.h" | 12 #include "ppapi/cpp/private/network_list_private.h" |
| 13 #include "ppapi/cpp/private/net_address_private.h" | 13 #include "ppapi/cpp/private/net_address_private.h" |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 | 16 |
| 17 PepperNetworkManager::PepperNetworkManager(const pp::InstanceHandle& instance) | 17 PepperNetworkManager::PepperNetworkManager(const pp::InstanceHandle& instance) |
| 18 : monitor_(instance, &PepperNetworkManager::OnNetworkListCallbackHandler, | 18 : monitor_(instance, &PepperNetworkManager::OnNetworkListCallbackHandler, |
| 19 this), | 19 this), |
| 20 start_count_(0), | 20 start_count_(0), |
| 21 network_list_received_(false), | 21 network_list_received_(false), |
| 22 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 22 weak_factory_(this) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 PepperNetworkManager::~PepperNetworkManager() { | 25 PepperNetworkManager::~PepperNetworkManager() { |
| 26 DCHECK(!start_count_); | 26 DCHECK(!start_count_); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void PepperNetworkManager::StartUpdating() { | 29 void PepperNetworkManager::StartUpdating() { |
| 30 if (network_list_received_) { | 30 if (network_list_received_) { |
| 31 // Post a task to avoid reentrancy. | 31 // Post a task to avoid reentrancy. |
| 32 base::ThreadTaskRunnerHandle::Get()->PostTask( | 32 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 MergeNetworkList(networks, &changed); | 104 MergeNetworkList(networks, &changed); |
| 105 if (changed) | 105 if (changed) |
| 106 SignalNetworksChanged(); | 106 SignalNetworksChanged(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void PepperNetworkManager::SendNetworksChangedSignal() { | 109 void PepperNetworkManager::SendNetworksChangedSignal() { |
| 110 SignalNetworksChanged(); | 110 SignalNetworksChanged(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace remoting | 113 } // namespace remoting |
| OLD | NEW |