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

Side by Side Diff: ppapi/proxy/ppb_file_chooser_proxy.h

Issue 10544089: Implement the file chooser as a new resource "host" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_
6 #define PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_
7
8 #include <string>
9 #include <vector>
10
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_completion_callback_factory.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"
20
21 namespace ppapi {
22
23 class HostResource;
24 struct PPB_FileRef_CreateInfo;
25
26 namespace proxy {
27
28 class PPB_FileChooser_Proxy : public InterfaceProxy {
29 public:
30 explicit PPB_FileChooser_Proxy(Dispatcher* dispatcher);
31 virtual ~PPB_FileChooser_Proxy();
32
33 static PP_Resource CreateProxyResource(
34 PP_Instance instance,
35 PP_FileChooserMode_Dev mode,
36 const char* accept_types);
37
38 // InterfaceProxy implementation.
39 virtual bool OnMessageReceived(const IPC::Message& msg);
40
41 static const ApiID kApiID = API_ID_PPB_FILE_CHOOSER;
42
43 private:
44 // Plugin -> host message handlers.
45 void OnMsgCreate(PP_Instance instance,
46 int mode,
47 std::string accept_types,
48 ppapi::HostResource* result);
49 void OnMsgShow(const ppapi::HostResource& chooser,
50 PP_Bool save_as,
51 SerializedVarReceiveInput suggested_file_name,
52 bool require_user_gesture);
53
54 // Host -> plugin message handlers.
55 void OnMsgChooseComplete(
56 const ppapi::HostResource& chooser,
57 int32_t result_code,
58 const std::vector<PPB_FileRef_CreateInfo>& chosen_files);
59
60 // Called when the show is complete in the host. This will notify the plugin
61 // via IPC and OnMsgChooseComplete will be called there.
62 void OnShowCallback(
63 int32_t result,
64 scoped_refptr<RefCountedArrayOutputAdapter<PP_Resource> > output,
65 HostResource chooser);
66
67 ProxyCompletionCallbackFactory<PPB_FileChooser_Proxy> callback_factory_;
68
69 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy);
70 };
71
72 } // namespace proxy
73 } // namespace ppapi
74
75 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698