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

Side by Side Diff: content/child/npapi/npobject_stub.h

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « content/child/npapi/npobject_proxy.cc ('k') | content/child/npapi/npobject_stub.cc » ('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 2013 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 // A class that receives IPC messages from an NPObjectProxy and calls the real
6 // NPObject.
7
8 #ifndef CONTENT_CHILD_NPAPI_NPOBJECT_STUB_H_
9 #define CONTENT_CHILD_NPAPI_NPOBJECT_STUB_H_
10
11 #include <vector>
12
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h"
15 #include "content/child/npapi/npobject_base.h"
16 #include "ipc/ipc_listener.h"
17 #include "ipc/ipc_sender.h"
18 #include "url/gurl.h"
19
20 struct NPObject;
21
22 namespace content {
23 class NPChannelBase;
24 struct NPIdentifier_Param;
25 struct NPVariant_Param;
26
27 // This wraps an NPObject and converts IPC messages from NPObjectProxy to calls
28 // to the object. The results are marshalled back. See npobject_proxy.h for
29 // more information.
30 class NPObjectStub : public IPC::Listener,
31 public IPC::Sender,
32 public base::SupportsWeakPtr<NPObjectStub>,
33 public NPObjectBase {
34 public:
35 NPObjectStub(NPObject* npobject,
36 NPChannelBase* channel,
37 int route_id,
38 int render_view_id,
39 const GURL& page_url);
40 ~NPObjectStub() override;
41
42 // Schedules tear-down of this stub. The underlying NPObject reference is
43 // released, and further invokations from the IPC channel will fail once this
44 // call has returned. Deletion of the stub is deferred to the main loop, in
45 // case it is touched as the stack unwinds. DeleteSoon() is safe to call
46 // more than once, until control returns to the main loop.
47 void DeleteSoon();
48
49 // IPC::Sender implementation:
50 bool Send(IPC::Message* msg) override;
51
52 // NPObjectBase implementation.
53 NPObject* GetUnderlyingNPObject() override;
54 IPC::Listener* GetChannelListener() override;
55
56 private:
57 // IPC::Listener implementation:
58 bool OnMessageReceived(const IPC::Message& message) override;
59 void OnChannelError() override;
60
61 // message handlers
62 void OnRelease(IPC::Message* reply_msg);
63 void OnHasMethod(const NPIdentifier_Param& name,
64 bool* result);
65 void OnInvoke(bool is_default,
66 const NPIdentifier_Param& method,
67 const std::vector<NPVariant_Param>& args,
68 IPC::Message* reply_msg);
69 void OnHasProperty(const NPIdentifier_Param& name,
70 bool* result);
71 void OnGetProperty(const NPIdentifier_Param& name,
72 NPVariant_Param* property,
73 bool* result);
74 void OnSetProperty(const NPIdentifier_Param& name,
75 const NPVariant_Param& property,
76 IPC::Message* reply_msg);
77 void OnRemoveProperty(const NPIdentifier_Param& name,
78 bool* result);
79 void OnInvalidate();
80 void OnEnumeration(std::vector<NPIdentifier_Param>* value,
81 bool* result);
82 void OnConstruct(const std::vector<NPVariant_Param>& args,
83 IPC::Message* reply_msg);
84 void OnEvaluate(const std::string& script, bool popups_allowed,
85 IPC::Message* reply_msg);
86
87 private:
88 NPObject* npobject_;
89 scoped_refptr<NPChannelBase> channel_;
90 int route_id_;
91 int render_view_id_;
92
93 // The url of the main frame hosting the plugin.
94 GURL page_url_;
95 };
96
97 } // namespace content
98
99 #endif // CONTENT_CHILD_NPAPI_NPOBJECT_STUB_H_
OLDNEW
« no previous file with comments | « content/child/npapi/npobject_proxy.cc ('k') | content/child/npapi/npobject_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698