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 #ifndef PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_
6 #define PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_
11 #include "base/basictypes.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/proxy/interface_proxy.h"
14 #include "ppapi/proxy/proxy_array_output.h"
15 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
16 #include "ppapi/proxy/serialized_var.h"
17 #include "ppapi/thunk/ppb_file_chooser_api.h"
18 #include "ppapi/cpp/output_traits.h"
19 #include "ppapi/utility/completion_callback_factory.h"
24 struct PPB_FileRef_CreateInfo
;
28 class PPB_FileChooser_Proxy
: public InterfaceProxy
{
30 explicit PPB_FileChooser_Proxy(Dispatcher
* dispatcher
);
31 virtual ~PPB_FileChooser_Proxy();
33 static PP_Resource
CreateProxyResource(
35 PP_FileChooserMode_Dev mode
,
36 const char* accept_types
);
38 // InterfaceProxy implementation.
39 virtual bool OnMessageReceived(const IPC::Message
& msg
);
41 static const ApiID kApiID
= API_ID_PPB_FILE_CHOOSER
;
44 // Plugin -> host message handlers.
45 void OnMsgCreate(PP_Instance instance
,
47 std::string accept_types
,
48 ppapi::HostResource
* result
);
49 void OnMsgShow(const ppapi::HostResource
& chooser
,
51 SerializedVarReceiveInput suggested_file_name
,
52 bool require_user_gesture
);
54 // Host -> plugin message handlers.
55 void OnMsgChooseComplete(
56 const ppapi::HostResource
& chooser
,
58 const std::vector
<PPB_FileRef_CreateInfo
>& chosen_files
);
60 // Called when the show is complete in the host. This will notify the plugin
61 // via IPC and OnMsgChooseComplete will be called there.
64 scoped_refptr
<RefCountedArrayOutputAdapter
<PP_Resource
> > output
,
65 HostResource chooser
);
67 pp::CompletionCallbackFactory
<PPB_FileChooser_Proxy
,
68 ProxyNonThreadSafeRefCount
> callback_factory_
;
70 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy
);
76 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_