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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // TODO(yzshen): Refactor ppapi::host::ResourceMessageFilter to support message | 35 // TODO(yzshen): Refactor ppapi::host::ResourceMessageFilter to support message |
36 // handling on the same thread, and then derive this class from the filter | 36 // handling on the same thread, and then derive this class from the filter |
37 // class. | 37 // class. |
38 class CONTENT_EXPORT PepperDeviceEnumerationHostHelper { | 38 class CONTENT_EXPORT PepperDeviceEnumerationHostHelper { |
39 public: | 39 public: |
40 class Delegate { | 40 class Delegate { |
41 public: | 41 public: |
42 virtual ~Delegate() {} | 42 virtual ~Delegate() {} |
43 | 43 |
44 typedef base::Callback< | 44 typedef base::Callback< |
45 void (int /* request_id */, | 45 void(int /* request_id */, |
46 const std::vector<ppapi::DeviceRefData>& /* devices */)> | 46 const std::vector<ppapi::DeviceRefData>& /* devices */)> |
47 EnumerateDevicesCallback; | 47 EnumerateDevicesCallback; |
48 | 48 |
49 // Enumerates devices of the specified type. The request ID passed into the | 49 // Enumerates devices of the specified type. The request ID passed into the |
50 // callback will be the same as the return value. | 50 // callback will be the same as the return value. |
51 virtual int EnumerateDevices(PP_DeviceType_Dev type, | 51 virtual int EnumerateDevices(PP_DeviceType_Dev type, |
52 const GURL& document_url, | 52 const GURL& document_url, |
53 const EnumerateDevicesCallback& callback) = 0; | 53 const EnumerateDevicesCallback& callback) = 0; |
54 // Stop enumerating devices of the specified |request_id|. The |request_id| | 54 // Stop enumerating devices of the specified |request_id|. The |request_id| |
55 // is the return value of EnumerateDevicesCallback. | 55 // is the return value of EnumerateDevicesCallback. |
56 virtual void StopEnumerateDevices(int request_id) = 0; | 56 virtual void StopEnumerateDevices(int request_id) = 0; |
(...skipping 23 matching lines...) Expand all Loading... |
80 | 80 |
81 int32_t OnEnumerateDevices(ppapi::host::HostMessageContext* context); | 81 int32_t OnEnumerateDevices(ppapi::host::HostMessageContext* context); |
82 int32_t OnMonitorDeviceChange(ppapi::host::HostMessageContext* context, | 82 int32_t OnMonitorDeviceChange(ppapi::host::HostMessageContext* context, |
83 uint32_t callback_id); | 83 uint32_t callback_id); |
84 int32_t OnStopMonitoringDeviceChange( | 84 int32_t OnStopMonitoringDeviceChange( |
85 ppapi::host::HostMessageContext* context); | 85 ppapi::host::HostMessageContext* context); |
86 | 86 |
87 void OnEnumerateDevicesComplete( | 87 void OnEnumerateDevicesComplete( |
88 int request_id, | 88 int request_id, |
89 const std::vector<ppapi::DeviceRefData>& devices); | 89 const std::vector<ppapi::DeviceRefData>& devices); |
90 void OnNotifyDeviceChange( | 90 void OnNotifyDeviceChange(uint32_t callback_id, |
91 uint32_t callback_id, | 91 int request_id, |
92 int request_id, | 92 const std::vector<ppapi::DeviceRefData>& devices); |
93 const std::vector<ppapi::DeviceRefData>& devices); | |
94 | 93 |
95 // Non-owning pointers. | 94 // Non-owning pointers. |
96 ppapi::host::ResourceHost* resource_host_; | 95 ppapi::host::ResourceHost* resource_host_; |
97 Delegate* delegate_; | 96 Delegate* delegate_; |
98 | 97 |
99 PP_DeviceType_Dev device_type_; | 98 PP_DeviceType_Dev device_type_; |
100 GURL document_url_; | 99 GURL document_url_; |
101 | 100 |
102 scoped_ptr<ScopedRequest> enumerate_; | 101 scoped_ptr<ScopedRequest> enumerate_; |
103 scoped_ptr<ScopedRequest> monitor_; | 102 scoped_ptr<ScopedRequest> monitor_; |
104 | 103 |
105 scoped_ptr<ppapi::host::ReplyMessageContext> enumerate_devices_context_; | 104 scoped_ptr<ppapi::host::ReplyMessageContext> enumerate_devices_context_; |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper); | 106 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper); |
108 }; | 107 }; |
109 | 108 |
110 } // namespace content | 109 } // namespace content |
111 | 110 |
112 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ | 111 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ |
OLD | NEW |