OLD | NEW |
| (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 #ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ | |
6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "chrome/default_plugin/plugin_installer_base.h" | |
12 #include "third_party/npapi/bindings/npapi.h" | |
13 #include "ui/gfx/native_widget_types.h" | |
14 | |
15 // Provides the plugin installation functionality. This class is | |
16 // instantiated with the information like the mime type of the | |
17 // target plugin, the display mode, etc. | |
18 class PluginInstallerImpl : public PluginInstallerBase { | |
19 public: | |
20 // mode is the plugin instantiation mode, i.e. whether it is a full | |
21 // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) | |
22 explicit PluginInstallerImpl(int16 mode); | |
23 virtual ~PluginInstallerImpl(); | |
24 | |
25 // Initializes the plugin with the instance information, mime type | |
26 // and the list of parameters passed down to the plugin from the webpage. | |
27 // | |
28 // Parameters: | |
29 // module_handle | |
30 // The handle to the dll in which this object is instantiated. | |
31 // instance | |
32 // The plugins opaque instance handle. | |
33 // mime_type | |
34 // Identifies the third party plugin which would be eventually installed. | |
35 // argc | |
36 // Indicates the count of arguments passed in from the webpage. | |
37 // argv | |
38 // Pointer to the arguments. | |
39 // Returns true on success. | |
40 bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type, | |
41 int16 argc, char* argn[], char* argv[]); | |
42 | |
43 // Informs the plugin of its window information. | |
44 // | |
45 // Parameters: | |
46 // window_info | |
47 // The window info passed to npapi. | |
48 bool NPP_SetWindow(NPWindow* window_info); | |
49 | |
50 // Destroys the install dialog. | |
51 void Shutdown(); | |
52 | |
53 // Starts plugin download. Spawns the plugin installer after it is | |
54 // downloaded. | |
55 void DownloadPlugin(); | |
56 | |
57 // Indicates that the plugin download was cancelled. | |
58 void DownloadCancelled(); | |
59 | |
60 // Initializes the plugin download stream. | |
61 // | |
62 // Parameters: | |
63 // stream | |
64 // Pointer to the new stream being created. | |
65 void NewStream(NPStream* stream); | |
66 | |
67 // Uninitializes the plugin download stream. | |
68 // | |
69 // Parameters: | |
70 // stream | |
71 // Pointer to the stream being destroyed. | |
72 // reason | |
73 // Indicates why the stream is being destroyed. | |
74 // | |
75 void DestroyStream(NPStream* stream, NPError reason); | |
76 | |
77 // Determines whether the plugin is ready to accept data. | |
78 // We only accept data when we have initiated a download for the plugin | |
79 // database. | |
80 // | |
81 // Parameters: | |
82 // stream | |
83 // Pointer to the stream being destroyed. | |
84 // Returns true if the plugin is ready to accept data. | |
85 bool WriteReady(NPStream* stream); | |
86 | |
87 // Delivers data to the plugin instance. | |
88 // | |
89 // Parameters: | |
90 // stream | |
91 // Pointer to the stream being destroyed. | |
92 // offset | |
93 // Indicates the data offset. | |
94 // buffer_length | |
95 // Indicates the length of the data buffer. | |
96 // buffer | |
97 // Pointer to the actual buffer. | |
98 // Returns the number of bytes actually written, 0 on error. | |
99 int32 Write(NPStream* stream, int32 offset, int32 buffer_length, | |
100 void* buffer); | |
101 | |
102 // Handles notifications received in response to GetURLNotify calls issued | |
103 // by the plugin. | |
104 // | |
105 // Parameters: | |
106 // url | |
107 // Pointer to the URL. | |
108 // reason | |
109 // Describes why the notification was sent. | |
110 void URLNotify(const char* url, NPReason reason); | |
111 | |
112 // Used by the renderer to pass events (for e.g. input events) to the plugin. | |
113 int16 NPP_HandleEvent(void* event); | |
114 | |
115 private: | |
116 DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); | |
117 }; | |
118 | |
119 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ | |
OLD | NEW |