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 "content/renderer/pepper/pepper_device_enumeration_host_helper.h" | 5 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 // EnumerateDevicesCallbackBody() to ensure that we always call |callback| | 46 // EnumerateDevicesCallbackBody() to ensure that we always call |callback| |
47 // asynchronously. | 47 // asynchronously. |
48 sync_call_ = true; | 48 sync_call_ = true; |
49 request_id_ = owner_->delegate_->EnumerateDevices( | 49 request_id_ = owner_->delegate_->EnumerateDevices( |
50 owner_->device_type_, | 50 owner_->device_type_, |
51 owner_->document_url_, | 51 owner_->document_url_, |
52 base::Bind(&ScopedRequest::EnumerateDevicesCallbackBody, AsWeakPtr())); | 52 base::Bind(&ScopedRequest::EnumerateDevicesCallbackBody, AsWeakPtr())); |
53 sync_call_ = false; | 53 sync_call_ = false; |
54 } | 54 } |
55 | 55 |
56 ~ScopedRequest() { | 56 ~ScopedRequest() {} |
dmichael (off chromium)
2014/05/27 20:43:23
Another thing this was doing was canceling the req
Henrik Grunell
2014/05/28 11:08:27
OK. It sounds like the cancel should be kept. Are
dmichael (off chromium)
2014/05/28 15:08:37
I'm not sure what you mean? Do you mean putting th
| |
57 if (requested_) { | |
58 owner_->delegate_->StopEnumerateDevices(request_id_); | |
59 } | |
60 } | |
61 | 57 |
62 bool requested() const { return requested_; } | 58 bool requested() const { return requested_; } |
63 | 59 |
64 private: | 60 private: |
65 void EnumerateDevicesCallbackBody( | 61 void EnumerateDevicesCallbackBody( |
66 int request_id, | 62 int request_id, |
67 const std::vector<ppapi::DeviceRefData>& devices) { | 63 const std::vector<ppapi::DeviceRefData>& devices) { |
68 if (sync_call_) { | 64 if (sync_call_) { |
69 base::MessageLoop::current()->PostTask( | 65 base::MessageLoop::current()->PostTask( |
70 FROM_HERE, | 66 FROM_HERE, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 uint32_t callback_id, | 178 uint32_t callback_id, |
183 int /* request_id */, | 179 int /* request_id */, |
184 const std::vector<ppapi::DeviceRefData>& devices) { | 180 const std::vector<ppapi::DeviceRefData>& devices) { |
185 resource_host_->host()->SendUnsolicitedReply( | 181 resource_host_->host()->SendUnsolicitedReply( |
186 resource_host_->pp_resource(), | 182 resource_host_->pp_resource(), |
187 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(callback_id, | 183 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(callback_id, |
188 devices)); | 184 devices)); |
189 } | 185 } |
190 | 186 |
191 } // namespace content | 187 } // namespace content |
OLD | NEW |