| 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 CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ | |
| 6 #define CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "build/build_config.h" | |
| 13 #include "content/common/cursors/webcursor.h" | |
| 14 #include "third_party/npapi/bindings/npapi.h" | |
| 15 #include "ui/gfx/native_widget_types.h" | |
| 16 | |
| 17 class GURL; | |
| 18 class SkCanvas; | |
| 19 struct NPObject; | |
| 20 | |
| 21 namespace blink { | |
| 22 class WebInputEvent; | |
| 23 } | |
| 24 | |
| 25 namespace gfx { | |
| 26 class Rect; | |
| 27 } | |
| 28 | |
| 29 namespace content { | |
| 30 | |
| 31 struct Referrer; | |
| 32 class WebPluginResourceClient; | |
| 33 | |
| 34 // This is the interface that a plugin implementation needs to provide. | |
| 35 class WebPluginDelegate { | |
| 36 public: | |
| 37 virtual ~WebPluginDelegate() {} | |
| 38 | |
| 39 // Initializes the plugin implementation with the given (UTF8) arguments. | |
| 40 // Note that the lifetime of WebPlugin must be longer than this delegate. | |
| 41 // If this function returns false the plugin isn't started and shouldn't be | |
| 42 // called again. If this method succeeds, then the WebPlugin is valid until | |
| 43 // PluginDestroyed is called. | |
| 44 // The load_manually parameter if true indicates that the plugin data would | |
| 45 // be passed from webkit. if false indicates that the plugin should download | |
| 46 // the data. This also controls whether the plugin is instantiated as a full | |
| 47 // page plugin (NP_FULL) or embedded (NP_EMBED). | |
| 48 virtual bool Initialize(const GURL& url, | |
| 49 const std::vector<std::string>& arg_names, | |
| 50 const std::vector<std::string>& arg_values, | |
| 51 bool load_manually) = 0; | |
| 52 | |
| 53 // Called when the WebPlugin is being destroyed. This is a signal to the | |
| 54 // delegate that it should tear-down the plugin implementation and not call | |
| 55 // methods on the WebPlugin again. | |
| 56 virtual void PluginDestroyed() = 0; | |
| 57 | |
| 58 // Update the geometry of the plugin. This is a request to move the | |
| 59 // plugin, relative to its containing window, to the coords given by | |
| 60 // window_rect. Its contents should be clipped to the coords given | |
| 61 // by clip_rect, which are relative to the origin of the plugin | |
| 62 // window. The clip_rect is in plugin-relative coordinates. | |
| 63 virtual void UpdateGeometry(const gfx::Rect& window_rect, | |
| 64 const gfx::Rect& clip_rect) = 0; | |
| 65 | |
| 66 // Tells the plugin to paint the damaged rect. |canvas| is only used for | |
| 67 // windowless plugins. | |
| 68 virtual void Paint(SkCanvas* canvas, const gfx::Rect& rect) = 0; | |
| 69 | |
| 70 // Informs the plugin that it has gained or lost focus. This is only called in | |
| 71 // windowless mode. | |
| 72 virtual void SetFocus(bool focused) = 0; | |
| 73 | |
| 74 // For windowless plugins, gives them a user event like mouse/keyboard. | |
| 75 // Returns whether the event was handled. This is only called in windowsless | |
| 76 // mode. See NPAPI NPP_HandleEvent for more information. | |
| 77 virtual bool HandleInputEvent(const blink::WebInputEvent& event, | |
| 78 WebCursor::CursorInfo* cursor) = 0; | |
| 79 | |
| 80 // Returns the process id of the process that is running the plugin. | |
| 81 virtual int GetProcessId() = 0; | |
| 82 }; | |
| 83 | |
| 84 } // namespace content | |
| 85 | |
| 86 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ | |
| OLD | NEW |