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" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "ppapi/c/dev/ppb_device_ref_dev.h" | 14 #include "ppapi/c/dev/ppb_device_ref_dev.h" |
| 15 #include "url/gurl.h" |
15 | 16 |
16 namespace ppapi { | 17 namespace ppapi { |
17 struct DeviceRefData; | 18 struct DeviceRefData; |
18 | 19 |
19 namespace host { | 20 namespace host { |
20 struct HostMessageContext; | 21 struct HostMessageContext; |
21 struct ReplyMessageContext; | 22 struct ReplyMessageContext; |
22 class ResourceHost; | 23 class ResourceHost; |
23 } | 24 } |
24 } | 25 } |
(...skipping 17 matching lines...) Expand all Loading... |
42 | 43 |
43 typedef base::Callback< | 44 typedef base::Callback< |
44 void (int /* request_id */, | 45 void (int /* request_id */, |
45 bool /* succeeded */, | 46 bool /* succeeded */, |
46 const std::vector<ppapi::DeviceRefData>& /* devices */)> | 47 const std::vector<ppapi::DeviceRefData>& /* devices */)> |
47 EnumerateDevicesCallback; | 48 EnumerateDevicesCallback; |
48 | 49 |
49 // Enumerates devices of the specified type. The request ID passed into the | 50 // Enumerates devices of the specified type. The request ID passed into the |
50 // callback will be the same as the return value. | 51 // callback will be the same as the return value. |
51 virtual int EnumerateDevices(PP_DeviceType_Dev type, | 52 virtual int EnumerateDevices(PP_DeviceType_Dev type, |
| 53 const GURL& document_url, |
52 const EnumerateDevicesCallback& callback) = 0; | 54 const EnumerateDevicesCallback& callback) = 0; |
53 // Stop enumerating devices of the specified |request_id|. The |request_id| | 55 // Stop enumerating devices of the specified |request_id|. The |request_id| |
54 // is the return value of EnumerateDevicesCallback. | 56 // is the return value of EnumerateDevicesCallback. |
55 virtual void StopEnumerateDevices(int request_id) = 0; | 57 virtual void StopEnumerateDevices(int request_id) = 0; |
56 }; | 58 }; |
57 | 59 |
58 // |resource_host| and |delegate| must outlive this object. | 60 // |resource_host| and |delegate| must outlive this object. |
59 PepperDeviceEnumerationHostHelper(ppapi::host::ResourceHost* resource_host, | 61 PepperDeviceEnumerationHostHelper(ppapi::host::ResourceHost* resource_host, |
60 Delegate* delegate, | 62 Delegate* delegate, |
61 PP_DeviceType_Dev device_type); | 63 PP_DeviceType_Dev device_type, |
| 64 const GURL& document_url); |
62 ~PepperDeviceEnumerationHostHelper(); | 65 ~PepperDeviceEnumerationHostHelper(); |
63 | 66 |
64 // Returns true if the message has been handled. | 67 // Returns true if the message has been handled. |
65 bool HandleResourceMessage(const IPC::Message& msg, | 68 bool HandleResourceMessage(const IPC::Message& msg, |
66 ppapi::host::HostMessageContext* context, | 69 ppapi::host::HostMessageContext* context, |
67 int32_t* result); | 70 int32_t* result); |
68 | 71 |
69 private: | 72 private: |
70 class ScopedRequest; | 73 class ScopedRequest; |
71 | 74 |
(...skipping 18 matching lines...) Expand all Loading... |
90 uint32_t callback_id, | 93 uint32_t callback_id, |
91 int request_id, | 94 int request_id, |
92 bool succeeded, | 95 bool succeeded, |
93 const std::vector<ppapi::DeviceRefData>& devices); | 96 const std::vector<ppapi::DeviceRefData>& devices); |
94 | 97 |
95 // Non-owning pointers. | 98 // Non-owning pointers. |
96 ppapi::host::ResourceHost* resource_host_; | 99 ppapi::host::ResourceHost* resource_host_; |
97 Delegate* delegate_; | 100 Delegate* delegate_; |
98 | 101 |
99 PP_DeviceType_Dev device_type_; | 102 PP_DeviceType_Dev device_type_; |
| 103 GURL document_url_; |
100 | 104 |
101 scoped_ptr<ScopedRequest> enumerate_; | 105 scoped_ptr<ScopedRequest> enumerate_; |
102 scoped_ptr<ScopedRequest> monitor_; | 106 scoped_ptr<ScopedRequest> monitor_; |
103 | 107 |
104 scoped_ptr<ppapi::host::ReplyMessageContext> enumerate_devices_context_; | 108 scoped_ptr<ppapi::host::ReplyMessageContext> enumerate_devices_context_; |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper); | 110 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper); |
107 }; | 111 }; |
108 | 112 |
109 } // namespace content | 113 } // namespace content |
110 | 114 |
111 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ | 115 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ |
OLD | NEW |