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

Side by Side Diff: webkit/glue/plugins/plugin_host.h

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | « webkit/glue/plugins/plugin_group_unittest.cc ('k') | webkit/glue/plugins/plugin_host.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 (c) 2010 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 // TODO: Need mechanism to cleanup the static instance
6
7 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_HOST_H__
8 #define WEBKIT_GLUE_PLUGIN_PLUGIN_HOST_H__
9
10 #include <string>
11 #include <vector>
12
13 #include "base/ref_counted.h"
14 #include "third_party/npapi/bindings/npapi.h"
15 #include "third_party/npapi/bindings/nphostapi.h"
16
17 namespace NPAPI
18 {
19 class PluginInstance;
20
21 // The Plugin Host implements the NPN_xxx functions for NPAPI plugins.
22 // These are the functions exposed from the Plugin Host for use
23 // by the Plugin.
24 //
25 // The PluginHost is managed as a singleton. This isn't strictly
26 // necessary, but since the callback functions are all global C
27 // functions, there is really no point in having per-instance PluginHosts.
28 class PluginHost : public base::RefCounted<PluginHost> {
29 public:
30 // Access the single PluginHost instance. Callers
31 // must call deref() when finished with the object.
32 static PluginHost *Singleton();
33
34 // The table of functions provided to the plugin.
35 NPNetscapeFuncs *host_functions() { return &host_funcs_; }
36
37 // Helper function for parsing post headers, and applying attributes
38 // to the stream. NPAPI post data include headers + data combined.
39 // This function parses it out and adds it to the stream in a WebKit
40 // style.
41 static bool SetPostData(const char *buf,
42 uint32 length,
43 std::vector<std::string>* names,
44 std::vector<std::string>* values,
45 std::vector<char>* body);
46
47 void PatchNPNetscapeFuncs(NPNetscapeFuncs* overrides);
48
49 private:
50 friend class base::RefCounted<PluginHost>;
51
52 virtual ~PluginHost();
53
54 PluginHost();
55 void InitializeHostFuncs();
56 static scoped_refptr<PluginHost> singleton_;
57 NPNetscapeFuncs host_funcs_;
58 DISALLOW_COPY_AND_ASSIGN(PluginHost);
59 };
60
61 } // namespace NPAPI
62
63 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_HOST_H__
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_group_unittest.cc ('k') | webkit/glue/plugins/plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698