| 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 "ppapi/proxy/ppb_network_monitor_private_proxy.h" | 5 #include "ppapi/proxy/ppb_network_monitor_private_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/enter_proxy.h" | 7 #include "ppapi/proxy/enter_proxy.h" |
| 8 #include "ppapi/proxy/plugin_proxy_delegate.h" | 8 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
| 10 #include "ppapi/thunk/ppb_network_monitor_private_api.h" | 10 #include "ppapi/thunk/ppb_network_monitor_private_api.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // If that is the first network monitor then send Start message. | 91 // If that is the first network monitor then send Start message. |
| 92 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 92 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( |
| 93 new PpapiHostMsg_PPBNetworkMonitor_Start( | 93 new PpapiHostMsg_PPBNetworkMonitor_Start( |
| 94 dispatcher->plugin_dispatcher_id())); | 94 dispatcher->plugin_dispatcher_id())); |
| 95 | 95 |
| 96 // We could have received network list message after sending the | 96 // We could have received network list message after sending the |
| 97 // previous Stop message. This list is stale now, so reset it | 97 // previous Stop message. This list is stale now, so reset it |
| 98 // here. | 98 // here. |
| 99 proxy->current_list_ = NULL; | 99 proxy->current_list_ = NULL; |
| 100 } else if (proxy->current_list_.get()) { | 100 } else if (proxy->current_list_.get()) { |
| 101 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 101 MessageLoop::current()->PostTask(FROM_HERE, RunWhileLocked(base::Bind( |
| 102 &NetworkMonitor::OnNetworkListReceived, | 102 &NetworkMonitor::OnNetworkListReceived, |
| 103 result->AsWeakPtr(), proxy->current_list_)); | 103 result->AsWeakPtr(), proxy->current_list_))); |
| 104 } | 104 } |
| 105 | 105 |
| 106 return result.release()->GetReference(); | 106 return result.release()->GetReference(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool PPB_NetworkMonitor_Private_Proxy::OnMessageReceived( | 109 bool PPB_NetworkMonitor_Private_Proxy::OnMessageReceived( |
| 110 const IPC::Message& msg) { | 110 const IPC::Message& msg) { |
| 111 bool handled = true; | 111 bool handled = true; |
| 112 IPC_BEGIN_MESSAGE_MAP(PPB_NetworkMonitor_Private_Proxy, msg) | 112 IPC_BEGIN_MESSAGE_MAP(PPB_NetworkMonitor_Private_Proxy, msg) |
| 113 IPC_MESSAGE_HANDLER(PpapiMsg_PPBNetworkMonitor_NetworkList, | 113 IPC_MESSAGE_HANDLER(PpapiMsg_PPBNetworkMonitor_NetworkList, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 137 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 137 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( |
| 138 new PpapiHostMsg_PPBNetworkMonitor_Stop( | 138 new PpapiHostMsg_PPBNetworkMonitor_Stop( |
| 139 dispatcher->plugin_dispatcher_id())); | 139 dispatcher->plugin_dispatcher_id())); |
| 140 } | 140 } |
| 141 current_list_ = NULL; | 141 current_list_ = NULL; |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace proxy | 145 } // namespace proxy |
| 146 } // namespace ppapi | 146 } // namespace ppapi |
| OLD | NEW |