Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: content/renderer/pepper/pepper_device_enumeration_host_helper.h

Issue 653243003: Pepper: Access PepperMediaDeviceManager through a WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_device_enumeration_host_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/weak_ptr.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 #include "ppapi/c/dev/ppb_device_ref_dev.h" 15 #include "ppapi/c/dev/ppb_device_ref_dev.h"
15 #include "ppapi/host/host_message_context.h" 16 #include "ppapi/host/host_message_context.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
18 namespace ppapi { 19 namespace ppapi {
19 struct DeviceRefData; 20 struct DeviceRefData;
20 21
21 namespace host { 22 namespace host {
22 class ResourceHost; 23 class ResourceHost;
(...skipping 28 matching lines...) Expand all
51 virtual int EnumerateDevices(PP_DeviceType_Dev type, 52 virtual int EnumerateDevices(PP_DeviceType_Dev type,
52 const GURL& document_url, 53 const GURL& document_url,
53 const EnumerateDevicesCallback& callback) = 0; 54 const EnumerateDevicesCallback& callback) = 0;
54 // Stop enumerating devices of the specified |request_id|. The |request_id| 55 // Stop enumerating devices of the specified |request_id|. The |request_id|
55 // is the return value of EnumerateDevicesCallback. 56 // is the return value of EnumerateDevicesCallback.
56 virtual void StopEnumerateDevices(int request_id) = 0; 57 virtual void StopEnumerateDevices(int request_id) = 0;
57 }; 58 };
58 59
59 // |resource_host| and |delegate| must outlive this object. 60 // |resource_host| and |delegate| must outlive this object.
60 PepperDeviceEnumerationHostHelper(ppapi::host::ResourceHost* resource_host, 61 PepperDeviceEnumerationHostHelper(ppapi::host::ResourceHost* resource_host,
61 Delegate* delegate, 62 base::WeakPtr<Delegate> delegate,
62 PP_DeviceType_Dev device_type, 63 PP_DeviceType_Dev device_type,
63 const GURL& document_url); 64 const GURL& document_url);
64 ~PepperDeviceEnumerationHostHelper(); 65 ~PepperDeviceEnumerationHostHelper();
65 66
66 // Returns true if the message has been handled. 67 // Returns true if the message has been handled.
67 bool HandleResourceMessage(const IPC::Message& msg, 68 bool HandleResourceMessage(const IPC::Message& msg,
68 ppapi::host::HostMessageContext* context, 69 ppapi::host::HostMessageContext* context,
69 int32_t* result); 70 int32_t* result);
70 71
71 private: 72 private:
(...skipping 14 matching lines...) Expand all
86 87
87 void OnEnumerateDevicesComplete( 88 void OnEnumerateDevicesComplete(
88 int request_id, 89 int request_id,
89 const std::vector<ppapi::DeviceRefData>& devices); 90 const std::vector<ppapi::DeviceRefData>& devices);
90 void OnNotifyDeviceChange(uint32_t callback_id, 91 void OnNotifyDeviceChange(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);
93 94
94 // Non-owning pointers. 95 // Non-owning pointers.
95 ppapi::host::ResourceHost* resource_host_; 96 ppapi::host::ResourceHost* resource_host_;
96 Delegate* delegate_; 97 base::WeakPtr<Delegate> delegate_;
97 98
98 PP_DeviceType_Dev device_type_; 99 PP_DeviceType_Dev device_type_;
99 GURL document_url_; 100 GURL document_url_;
100 101
101 scoped_ptr<ScopedRequest> enumerate_; 102 scoped_ptr<ScopedRequest> enumerate_;
102 scoped_ptr<ScopedRequest> monitor_; 103 scoped_ptr<ScopedRequest> monitor_;
103 104
104 ppapi::host::ReplyMessageContext enumerate_devices_context_; 105 ppapi::host::ReplyMessageContext enumerate_devices_context_;
105 106
106 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper); 107 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationHostHelper);
107 }; 108 };
108 109
109 } // namespace content 110 } // namespace content
110 111
111 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_ 112 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_HOST_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_device_enumeration_host_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698