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

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

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

Powered by Google App Engine
This is Rietveld 408576698