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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_bindings.h

Issue 10830072: Browser Plugin: New Implementation (Renderer Side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed leaky Persistents in BrowserPlugin Created 8 years, 4 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 WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
6 #define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "ppapi/shared_impl/resource.h"
10 #include "third_party/npapi/bindings/npruntime.h"
11
12 namespace WebKit {
13 class WebSerializedScriptValue;
14 }
15
16 namespace content {
17 namespace browser_plugin {
18
19 class BrowserPlugin;
20
21 class BrowserPluginBindings {
22 public:
23 // BrowserPluginNPObject is a simple struct that adds a pointer back to a
24 // BrowserPluginBindings instance. This way, we can use an NPObject to allow
25 // JavaScript interactions without forcing BrowserPluginBindings to inherit
26 // from NPObject.
27 struct BrowserPluginNPObject : public NPObject {
28 BrowserPluginNPObject();
29 ~BrowserPluginNPObject();
30
31 base::WeakPtr<BrowserPluginBindings> message_channel;
32 };
33
34 explicit BrowserPluginBindings(BrowserPlugin* instance);
35 ~BrowserPluginBindings();
36
37 NPObject* np_object() const { return np_object_; }
38
39 BrowserPlugin* instance() const { return instance_; }
40 private:
41 BrowserPlugin* instance_;
42 // The NPObject we use to expose postMessage to JavaScript.
43 BrowserPluginNPObject* np_object_;
44
45 // This is used to ensure pending tasks will not fire after this object is
46 // destroyed.
47 base::WeakPtrFactory<BrowserPluginBindings> weak_ptr_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindings);
50 };
51
52 } // namespace browser_plugin
53 } // namespace content
54
55 #endif // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698