OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // destroy() during initialization. When this occurs, container() will | 72 // destroy() during initialization. When this occurs, container() will |
73 // return nullptr. Because deletions during initialize() must be | 73 // return nullptr. Because deletions during initialize() must be |
74 // asynchronous, this object is still alive immediately after initialize(). | 74 // asynchronous, this object is still alive immediately after initialize(). |
75 // 1) If container() == nullptr and this method returns true, this plugin | 75 // 1) If container() == nullptr and this method returns true, this plugin |
76 // has been replaced by another during initialization. This new plugin | 76 // has been replaced by another during initialization. This new plugin |
77 // may be accessed via container->plugin(). | 77 // may be accessed via container->plugin(). |
78 // 2) If container() == nullptr and this method returns false, this plugin | 78 // 2) If container() == nullptr and this method returns false, this plugin |
79 // and the container have both been marked for deletion. | 79 // and the container have both been marked for deletion. |
80 virtual bool initialize(WebPluginContainer*) = 0; | 80 virtual bool initialize(WebPluginContainer*) = 0; |
81 | 81 |
82 // Plugins must arrange for themselves to be deleted sometime during or after
this | 82 // Plugins must arrange for themselves to be deleted sometime during or after |
83 // method is called. This method is only called by the owning WebPluginContain
er. | 83 // this method is called. This method is only called by the owning |
| 84 // WebPluginContainer. |
84 // The exception is if the plugin has been detached by a WebPluginContainer, | 85 // The exception is if the plugin has been detached by a WebPluginContainer, |
85 // i.e. been replaced by another plugin. Then it must be destroyed separately. | 86 // i.e. been replaced by another plugin. Then it must be destroyed separately. |
86 // Once this method has been called, container() must return nullptr. | 87 // Once this method has been called, container() must return nullptr. |
87 virtual void destroy() = 0; | 88 virtual void destroy() = 0; |
88 | 89 |
89 // Returns the container that this plugin has been initialized with. | 90 // Returns the container that this plugin has been initialized with. |
90 // Must return nullptr if this plugin is scheduled for deletion. | 91 // Must return nullptr if this plugin is scheduled for deletion. |
91 // | 92 // |
92 // NOTE: This container doesn't necessarily own this plugin. For example, | 93 // NOTE: This container doesn't necessarily own this plugin. For example, |
93 // if the container has been assigned a new plugin, then the container will | 94 // if the container has been assigned a new plugin, then the container will |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 virtual void didFinishLoading() = 0; | 137 virtual void didFinishLoading() = 0; |
137 virtual void didFailLoading(const WebURLError&) = 0; | 138 virtual void didFailLoading(const WebURLError&) = 0; |
138 | 139 |
139 // Printing interface. | 140 // Printing interface. |
140 // Whether the plugin supports its own paginated print. The other print | 141 // Whether the plugin supports its own paginated print. The other print |
141 // interface methods are called only if this method returns true. | 142 // interface methods are called only if this method returns true. |
142 virtual bool supportsPaginatedPrint() { return false; } | 143 virtual bool supportsPaginatedPrint() { return false; } |
143 // Returns true if the printed content should not be scaled to | 144 // Returns true if the printed content should not be scaled to |
144 // the printer's printable area. | 145 // the printer's printable area. |
145 virtual bool isPrintScalingDisabled() { return false; } | 146 virtual bool isPrintScalingDisabled() { return false; } |
146 // Returns true on success and sets the out parameter to the print preset opti
ons for the document. | 147 // Returns true on success and sets the out parameter to the print preset |
| 148 // options for the document. |
147 virtual bool getPrintPresetOptionsFromDocument(WebPrintPresetOptions*) { | 149 virtual bool getPrintPresetOptionsFromDocument(WebPrintPresetOptions*) { |
148 return false; | 150 return false; |
149 } | 151 } |
150 | 152 |
151 // Sets up printing with the specified printParams. Returns the number of | 153 // Sets up printing with the specified printParams. Returns the number of |
152 // pages to be printed at these settings. | 154 // pages to be printed at these settings. |
153 virtual int printBegin(const WebPrintParams& printParams) { return 0; } | 155 virtual int printBegin(const WebPrintParams& printParams) { return 0; } |
154 | 156 |
155 virtual void printPage(int pageNumber, WebCanvas* canvas) {} | 157 virtual void printPage(int pageNumber, WebCanvas* canvas) {} |
156 | 158 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Deletes the current selection plus the specified number of characters | 195 // Deletes the current selection plus the specified number of characters |
194 // before and after the selection or caret. | 196 // before and after the selection or caret. |
195 virtual void extendSelectionAndDelete(int before, int after) {} | 197 virtual void extendSelectionAndDelete(int before, int after) {} |
196 // If the given position is over a link, returns the absolute url. | 198 // If the given position is over a link, returns the absolute url. |
197 // Otherwise an empty url is returned. | 199 // Otherwise an empty url is returned. |
198 virtual WebURL linkAtPosition(const WebPoint& position) const { | 200 virtual WebURL linkAtPosition(const WebPoint& position) const { |
199 return WebURL(); | 201 return WebURL(); |
200 } | 202 } |
201 | 203 |
202 // Find interface. | 204 // Find interface. |
203 // Start a new search. The plugin should search for a little bit at a time so
that it | 205 // Start a new search. The plugin should search for a little bit at a time so |
204 // doesn't block the thread in case of a large document. The results, along w
ith the | 206 // that it doesn't block the thread in case of a large document. The results, |
205 // find's identifier, should be sent asynchronously to WebFrameClient's report
FindInPage* methods. | 207 // along with the find's identifier, should be sent asynchronously to |
206 // Returns true if the search started, or false if the plugin doesn't support
search. | 208 // WebFrameClient's reportFindInPage* methods. |
| 209 // Returns true if the search started, or false if the plugin doesn't support |
| 210 // search. |
207 virtual bool startFind(const WebString& searchText, | 211 virtual bool startFind(const WebString& searchText, |
208 bool caseSensitive, | 212 bool caseSensitive, |
209 int identifier) { | 213 int identifier) { |
210 return false; | 214 return false; |
211 } | 215 } |
212 // Tells the plugin to jump forward or backward in the list of find results. | 216 // Tells the plugin to jump forward or backward in the list of find results. |
213 virtual void selectFindResult(bool forward, int identifier) {} | 217 virtual void selectFindResult(bool forward, int identifier) {} |
214 // Tells the plugin that the user has stopped the find operation. | 218 // Tells the plugin that the user has stopped the find operation. |
215 virtual void stopFind() {} | 219 virtual void stopFind() {} |
216 | 220 |
217 // View rotation types. | 221 // View rotation types. |
218 enum RotationType { RotationType90Clockwise, RotationType90Counterclockwise }; | 222 enum RotationType { RotationType90Clockwise, RotationType90Counterclockwise }; |
219 // Whether the plugin can rotate the view of its content. | 223 // Whether the plugin can rotate the view of its content. |
220 virtual bool canRotateView() { return false; } | 224 virtual bool canRotateView() { return false; } |
221 // Rotates the plugin's view of its content. | 225 // Rotates the plugin's view of its content. |
222 virtual void rotateView(RotationType type) {} | 226 virtual void rotateView(RotationType type) {} |
223 | 227 |
224 virtual bool isPlaceholder() { return true; } | 228 virtual bool isPlaceholder() { return true; } |
225 | 229 |
226 protected: | 230 protected: |
227 ~WebPlugin() {} | 231 ~WebPlugin() {} |
228 }; | 232 }; |
229 | 233 |
230 } // namespace blink | 234 } // namespace blink |
231 | 235 |
232 #endif | 236 #endif |
OLD | NEW |