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

Side by Side Diff: ppapi/proxy/plugin_resource.cc

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, 6 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
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ppapi/proxy/plugin_resource.h"
6
7 #include "ppapi/proxy/ppapi_messages.h"
8 #include "ppapi/proxy/resource_message_params.h"
9
10 namespace ppapi {
11 namespace proxy {
12
13 PluginResource::PluginResource(IPC::Message::Sender* sender,
14 PP_Instance instance)
15 : Resource(OBJECT_IS_PROXY, instance),
16 sender_(sender),
17 next_sequence_number_(0),
18 sent_create_to_renderer_(false) {
19 }
20
21 PluginResource::~PluginResource() {
22 if (sent_create_to_renderer_)
23 Send(new PpapiHostMsg_ResourceDestroyed(pp_resource()));
24 }
25
26 bool PluginResource::Send(IPC::Message* message) {
27 return sender_->Send(message);
28 }
29
30 void PluginResource::SendCreateToRenderer(const IPC::Message& msg) {
31 DCHECK(!sent_create_to_renderer_);
32 sent_create_to_renderer_ = true;
33 ResourceMessageCallParams params(pp_resource(),
34 next_sequence_number_++);
35 Send(new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
36 }
37
38 void PluginResource::PostToRenderer(const IPC::Message& msg) {
39 ResourceMessageCallParams params(pp_resource(),
40 next_sequence_number_++);
41 Send(new PpapiHostMsg_ResourceCall(params, msg));
42 }
43
44 int32_t PluginResource::CallRenderer(const IPC::Message& msg) {
45 ResourceMessageCallParams params(pp_resource(),
46 next_sequence_number_++);
47 params.set_has_callback();
48 Send(new PpapiHostMsg_ResourceCall(params, msg));
49 return params.sequence();
50 }
51
52 } // namespace proxy
53 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698