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
3 // found in the LICENSE file.
5 #include "webkit/plugins/ppapi/mock_plugin_delegate.h"
7 #include "base/logging.h"
8 #include "base/message_loop_proxy.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/shared_impl/ppapi_preferences.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
12 #include "webkit/plugins/ppapi/mock_platform_image_2d.h"
13 #include "webkit/plugins/ppapi/plugin_delegate.h"
14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
19 MockPluginDelegate::MockPluginDelegate() {
22 MockPluginDelegate::~MockPluginDelegate() {
25 void MockPluginDelegate::PluginFocusChanged(PluginInstance
* instance
,
29 void MockPluginDelegate::PluginTextInputTypeChanged(PluginInstance
* instance
) {
32 void MockPluginDelegate::PluginCaretPositionChanged(PluginInstance
* instance
) {
35 void MockPluginDelegate::PluginRequestedCancelComposition(
36 PluginInstance
* instance
) {
39 void MockPluginDelegate::PluginSelectionChanged(PluginInstance
* instance
) {
42 void MockPluginDelegate::SimulateImeSetComposition(
43 const base::string16
& text
,
44 const std::vector
<WebKit::WebCompositionUnderline
>& underlines
,
49 void MockPluginDelegate::SimulateImeConfirmComposition(
50 const base::string16
& text
) {
53 void MockPluginDelegate::PluginCrashed(PluginInstance
* instance
) {
56 void MockPluginDelegate::InstanceCreated(PluginInstance
* instance
) {
59 void MockPluginDelegate::InstanceDeleted(PluginInstance
* instance
) {
62 scoped_ptr
< ::ppapi::thunk::ResourceCreationAPI
>
63 MockPluginDelegate::CreateResourceCreationAPI(PluginInstance
* instance
) {
64 return scoped_ptr
< ::ppapi::thunk::ResourceCreationAPI
>();
67 SkBitmap
* MockPluginDelegate::GetSadPluginBitmap() {
71 WebKit::WebPlugin
* MockPluginDelegate::CreatePluginReplacement(
72 const base::FilePath
& file_path
) {
76 MockPluginDelegate::PlatformImage2D
* MockPluginDelegate::CreateImage2D(
79 return new MockPlatformImage2D(width
, height
);
82 PluginDelegate::PlatformGraphics2D
* MockPluginDelegate::GetGraphics2D(
83 PluginInstance
* instance
,
84 PP_Resource graphics_2d
) {
88 MockPluginDelegate::PlatformContext3D
* MockPluginDelegate::CreateContext3D() {
91 void MockPluginDelegate::ReparentContext(
92 MockPluginDelegate::PlatformContext3D
* context
) {
95 MockPluginDelegate::PlatformVideoDecoder
*
96 MockPluginDelegate::CreateVideoDecoder(
97 media::VideoDecodeAccelerator::Client
* client
,
98 int32 command_buffer_route_id
) {
102 MockPluginDelegate::PlatformVideoCapture
*
103 MockPluginDelegate::CreateVideoCapture(
104 const std::string
& device_id
,
105 PlatformVideoCaptureEventHandler
* handler
){
109 uint32_t MockPluginDelegate::GetAudioHardwareOutputSampleRate() {
113 uint32_t MockPluginDelegate::GetAudioHardwareOutputBufferSize() {
117 MockPluginDelegate::PlatformAudioOutput
* MockPluginDelegate::CreateAudioOutput(
118 uint32_t sample_rate
,
119 uint32_t sample_count
,
120 PlatformAudioOutputClient
* client
) {
124 MockPluginDelegate::PlatformAudioInput
* MockPluginDelegate::CreateAudioInput(
125 const std::string
& device_id
,
126 uint32_t sample_rate
,
127 uint32_t sample_count
,
128 PlatformAudioInputClient
* client
) {
132 MockPluginDelegate::Broker
* MockPluginDelegate::ConnectToBroker(
133 PPB_Broker_Impl
* client
) {
137 void MockPluginDelegate::NumberOfFindResultsChanged(int identifier
,
142 void MockPluginDelegate::SelectedFindResultChanged(int identifier
, int index
) {
145 bool MockPluginDelegate::AsyncOpenFile(const base::FilePath
& path
,
147 const AsyncOpenFileCallback
& callback
) {
151 bool MockPluginDelegate::AsyncOpenFileSystemURL(
154 const AsyncOpenFileSystemURLCallback
& callback
) {
158 bool MockPluginDelegate::OpenFileSystem(
159 const GURL
& origin_url
,
160 fileapi::FileSystemType type
,
162 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
166 bool MockPluginDelegate::MakeDirectory(
169 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
173 bool MockPluginDelegate::Query(
175 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
179 bool MockPluginDelegate::Touch(
181 const base::Time
& last_access_time
,
182 const base::Time
& last_modified_time
,
183 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
187 bool MockPluginDelegate::SetLength(
190 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
194 bool MockPluginDelegate::Delete(
196 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
200 bool MockPluginDelegate::Rename(
201 const GURL
& file_path
,
202 const GURL
& new_file_path
,
203 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
207 bool MockPluginDelegate::ReadDirectory(
208 const GURL
& directory_path
,
209 fileapi::FileSystemCallbackDispatcher
* dispatcher
) {
213 void MockPluginDelegate::QueryAvailableSpace(
214 const GURL
& origin
, quota::StorageType type
,
215 const AvailableSpaceCallback
& callback
) {
218 void MockPluginDelegate::WillUpdateFile(const GURL
& file_path
) {
221 void MockPluginDelegate::DidUpdateFile(const GURL
& file_path
, int64_t delta
) {
224 void MockPluginDelegate::SyncGetFileSystemPlatformPath(
226 base::FilePath
* platform_path
) {
227 DCHECK(platform_path
);
228 *platform_path
= base::FilePath();
231 scoped_refptr
<base::MessageLoopProxy
>
232 MockPluginDelegate::GetFileThreadMessageLoopProxy() {
233 return scoped_refptr
<base::MessageLoopProxy
>();
236 uint32
MockPluginDelegate::TCPSocketCreate() {
240 void MockPluginDelegate::TCPSocketConnect(PPB_TCPSocket_Private_Impl
* socket
,
242 const std::string
& host
,
246 void MockPluginDelegate::TCPSocketConnectWithNetAddress(
247 PPB_TCPSocket_Private_Impl
* socket
,
249 const PP_NetAddress_Private
& addr
) {
252 void MockPluginDelegate::TCPSocketSSLHandshake(
254 const std::string
& server_name
,
255 uint16_t server_port
,
256 const std::vector
<std::vector
<char> >& trusted_certs
,
257 const std::vector
<std::vector
<char> >& untrusted_certs
) {
260 void MockPluginDelegate::TCPSocketRead(uint32 socket_id
,
261 int32_t bytes_to_read
) {
264 void MockPluginDelegate::TCPSocketWrite(uint32 socket_id
,
265 const std::string
& buffer
) {
268 void MockPluginDelegate::TCPSocketSetBoolOption(uint32 socket_id
,
269 PP_TCPSocketOption_Private name
,
273 void MockPluginDelegate::TCPSocketDisconnect(uint32 socket_id
) {
276 void MockPluginDelegate::RegisterTCPSocket(PPB_TCPSocket_Private_Impl
* socket
,
280 void MockPluginDelegate::TCPServerSocketListen(
281 PP_Resource socket_resource
,
282 const PP_NetAddress_Private
& addr
,
286 void MockPluginDelegate::TCPServerSocketAccept(uint32 server_socket_id
) {
289 void MockPluginDelegate::TCPServerSocketStopListening(
290 PP_Resource socket_resource
,
294 bool MockPluginDelegate::AddNetworkListObserver(
295 webkit_glue::NetworkListObserver
* observer
) {
299 void MockPluginDelegate::RemoveNetworkListObserver(
300 webkit_glue::NetworkListObserver
* observer
) {
303 bool MockPluginDelegate::X509CertificateParseDER(
304 const std::vector
<char>& der
,
305 ::ppapi::PPB_X509Certificate_Fields
* fields
) {
309 FullscreenContainer
* MockPluginDelegate::CreateFullscreenContainer(
310 PluginInstance
* instance
) {
314 gfx::Size
MockPluginDelegate::GetScreenSize() {
315 return gfx::Size(1024, 768);
318 std::string
MockPluginDelegate::GetDefaultEncoding() {
322 void MockPluginDelegate::ZoomLimitsChanged(double minimum_factor
,
323 double maximum_factor
) {
326 void MockPluginDelegate::DidStartLoading() {
329 void MockPluginDelegate::DidStopLoading() {
332 void MockPluginDelegate::SetContentRestriction(int restrictions
) {
335 void MockPluginDelegate::SaveURLAs(const GURL
& url
) {
338 base::SharedMemory
* MockPluginDelegate::CreateAnonymousSharedMemory(
343 ::ppapi::Preferences
MockPluginDelegate::GetPreferences() {
344 return ::ppapi::Preferences();
347 bool MockPluginDelegate::LockMouse(PluginInstance
* instance
) {
351 void MockPluginDelegate::UnlockMouse(PluginInstance
* instance
) {
354 bool MockPluginDelegate::IsMouseLocked(PluginInstance
* instance
) {
358 void MockPluginDelegate::DidChangeCursor(PluginInstance
* instance
,
359 const WebKit::WebCursorInfo
& cursor
) {
362 void MockPluginDelegate::DidReceiveMouseEvent(PluginInstance
* instance
) {
365 void MockPluginDelegate::SampleGamepads(WebKit::WebGamepads
* data
) {
369 bool MockPluginDelegate::IsInFullscreenMode() {
373 bool MockPluginDelegate::IsPageVisible() const {
377 int MockPluginDelegate::EnumerateDevices(
378 PP_DeviceType_Dev type
,
379 const EnumerateDevicesCallback
& callback
) {
383 void MockPluginDelegate::StopEnumerateDevices(int request_id
) {
386 IPC::PlatformFileForTransit
MockPluginDelegate::ShareHandleWithRemote(
387 base::PlatformFile handle
,
388 base::ProcessId target_process_id
,
389 bool should_close_source
) const {
390 return IPC::InvalidPlatformFileForTransit();
394 } // namespace webkit