OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_FRAME_CHROME_FRAME_NPAPI_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_NPAPI_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_NPAPI_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_NPAPI_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlwin.h> | 9 #include <atlwin.h> |
10 #include <string> | 10 #include <string> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ~ChromeFrameNPAPI(); | 58 ~ChromeFrameNPAPI(); |
59 | 59 |
60 bool Initialize(NPMIMEType mime_type, NPP instance, uint16 mode, | 60 bool Initialize(NPMIMEType mime_type, NPP instance, uint16 mode, |
61 int16 argc, char* argn[], char* argv[]); | 61 int16 argc, char* argn[], char* argv[]); |
62 void Uninitialize(); | 62 void Uninitialize(); |
63 | 63 |
64 bool SetWindow(NPWindow* window_info); | 64 bool SetWindow(NPWindow* window_info); |
65 void UrlNotify(const char* url, NPReason reason, void* notify_data); | 65 void UrlNotify(const char* url, NPReason reason, void* notify_data); |
66 bool NewStream(NPMIMEType type, NPStream* stream, NPBool seekable, | 66 bool NewStream(NPMIMEType type, NPStream* stream, NPBool seekable, |
67 uint16* stream_type); | 67 uint16* stream_type); |
| 68 int32 WriteReady(NPStream* stream); |
| 69 int32 Write(NPStream* stream, int32 offset, int32 len, void* buffer); |
| 70 NPError DestroyStream(NPStream* stream, NPReason reason); |
68 | 71 |
69 void Print(NPPrint* print_info); | 72 void Print(NPPrint* print_info); |
70 | 73 |
71 // NPObject functions, which ensure that the plugin object is scriptable. | 74 // NPObject functions, which ensure that the plugin object is scriptable. |
72 static bool HasMethod(NPObject* obj, NPIdentifier name); | 75 static bool HasMethod(NPObject* obj, NPIdentifier name); |
73 static bool Invoke(NPObject* header, NPIdentifier name, | 76 static bool Invoke(NPObject* header, NPIdentifier name, |
74 const NPVariant* args, uint32_t arg_count, | 77 const NPVariant* args, uint32_t arg_count, |
75 NPVariant* result); | 78 NPVariant* result); |
76 static NPObject* AllocateObject(NPP instance, NPClass* class_name); | 79 static NPObject* AllocateObject(NPP instance, NPClass* class_name); |
77 static void DeallocateObject(NPObject* header); | 80 static void DeallocateObject(NPObject* header); |
(...skipping 14 matching lines...) Expand all Loading... |
92 const NPVariant *variant); | 95 const NPVariant *variant); |
93 | 96 |
94 // Returns the ChromeFrameNPAPI object pointer from the NPP instance structure | 97 // Returns the ChromeFrameNPAPI object pointer from the NPP instance structure |
95 // passed in by the browser. | 98 // passed in by the browser. |
96 static ChromeFrameNPAPI* ChromeFrameInstanceFromPluginInstance(NPP instance); | 99 static ChromeFrameNPAPI* ChromeFrameInstanceFromPluginInstance(NPP instance); |
97 | 100 |
98 // Returns the ChromeFrameNPAPI object pointer from the NPObject structure | 101 // Returns the ChromeFrameNPAPI object pointer from the NPObject structure |
99 // which represents our plugin class. | 102 // which represents our plugin class. |
100 static ChromeFrameNPAPI* ChromeFrameInstanceFromNPObject(void* object); | 103 static ChromeFrameNPAPI* ChromeFrameInstanceFromNPObject(void* object); |
101 | 104 |
102 // Return a UrlRequest instance associated with the given instance and | |
103 // stream combination. | |
104 static NPAPIUrlRequest* ValidateRequest(NPP instance, void* notify_data); | |
105 | |
106 BEGIN_MSG_MAP(ChromeFrameNPAPI) | 105 BEGIN_MSG_MAP(ChromeFrameNPAPI) |
107 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) | 106 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) |
108 CHAIN_MSG_MAP(Base) | 107 CHAIN_MSG_MAP(Base) |
109 END_MSG_MAP() | 108 END_MSG_MAP() |
110 | 109 |
111 LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, | 110 LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, |
112 BOOL& handled); // NO_LINT | 111 BOOL& handled); // NO_LINT |
113 | 112 |
114 // Implementation of NpEventDelegate | 113 // Implementation of NpEventDelegate |
115 virtual void OnEvent(const char* event_name); | 114 virtual void OnEvent(const char* event_name); |
(...skipping 14 matching lines...) Expand all Loading... |
130 // Handler for accelerator messages passed on from the hosted chrome | 129 // Handler for accelerator messages passed on from the hosted chrome |
131 // instance. | 130 // instance. |
132 virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message); | 131 virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message); |
133 virtual void OnTabbedOut(int tab_handle, bool reverse); | 132 virtual void OnTabbedOut(int tab_handle, bool reverse); |
134 virtual void OnOpenURL(int tab_handle, const GURL& url, int open_disposition); | 133 virtual void OnOpenURL(int tab_handle, const GURL& url, int open_disposition); |
135 virtual void OnLoad(int tab_handle, const GURL& url); | 134 virtual void OnLoad(int tab_handle, const GURL& url); |
136 virtual void OnMessageFromChromeFrame(int tab_handle, | 135 virtual void OnMessageFromChromeFrame(int tab_handle, |
137 const std::string& message, | 136 const std::string& message, |
138 const std::string& origin, | 137 const std::string& origin, |
139 const std::string& target); | 138 const std::string& target); |
140 virtual void OnRequestStart(int tab_handle, int request_id, | |
141 const IPC::AutomationURLRequest& request); | |
142 virtual void OnRequestRead(int tab_handle, int request_id, | |
143 int bytes_to_read); | |
144 virtual void OnRequestEnd(int tab_handle, int request_id, | |
145 const URLRequestStatus& status); | |
146 virtual void OnSetCookieAsync(int tab_handle, const GURL& url, | 139 virtual void OnSetCookieAsync(int tab_handle, const GURL& url, |
147 const std::string& cookie); | 140 const std::string& cookie); |
148 | 141 |
149 // ChromeFrameDelegate overrides | 142 // ChromeFrameDelegate overrides |
150 virtual void OnLoadFailed(int error_code, const std::string& url); | 143 virtual void OnLoadFailed(int error_code, const std::string& url); |
151 virtual void OnAutomationServerReady(); | 144 virtual void OnAutomationServerReady(); |
152 virtual void OnAutomationServerLaunchFailed( | 145 virtual void OnAutomationServerLaunchFailed( |
153 AutomationLaunchResult reason, const std::string& server_version); | 146 AutomationLaunchResult reason, const std::string& server_version); |
154 virtual void OnExtensionInstalled(const FilePath& path, | 147 virtual void OnExtensionInstalled(const FilePath& path, |
155 void* user_data, AutomationMsg_ExtensionResponseValues response); | 148 void* user_data, AutomationMsg_ExtensionResponseValues response); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 virtual void SetReadyState(READYSTATE new_state) { | 269 virtual void SetReadyState(READYSTATE new_state) { |
277 ready_state_ = new_state; | 270 ready_state_ = new_state; |
278 NPVariant var; | 271 NPVariant var; |
279 INT32_TO_NPVARIANT(ready_state_, var); | 272 INT32_TO_NPVARIANT(ready_state_, var); |
280 FireEvent("readystatechanged", var); | 273 FireEvent("readystatechanged", var); |
281 } | 274 } |
282 | 275 |
283 // Host function to compile-time asserts over members of this class. | 276 // Host function to compile-time asserts over members of this class. |
284 static void CompileAsserts(); | 277 static void CompileAsserts(); |
285 | 278 |
286 // Get request from the stream notify data | |
287 NPAPIUrlRequest* RequestFromNotifyData(void* notify_data) const; | |
288 | |
289 static LRESULT CALLBACK DropKillFocusHook(int code, WPARAM wparam, | 279 static LRESULT CALLBACK DropKillFocusHook(int code, WPARAM wparam, |
290 LPARAM lparam); // NO_LINT | 280 LPARAM lparam); // NO_LINT |
291 | 281 |
292 // The plugins opaque instance handle | 282 // The plugins opaque instance handle |
293 NPP instance_; | 283 NPP instance_; |
294 | 284 |
295 // The plugin instantiation mode (NP_FULL or NP_EMBED) | 285 // The plugin instantiation mode (NP_FULL or NP_EMBED) |
296 int16 mode_; | 286 int16 mode_; |
297 // The plugins mime type. | 287 // The plugins mime type. |
298 std::string mime_type_; | 288 std::string mime_type_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // http://www.w3.org/TR/DOM-Level-3-Events/events.html#Event-types | 325 // http://www.w3.org/TR/DOM-Level-3-Events/events.html#Event-types |
336 | 326 |
337 READYSTATE ready_state_; | 327 READYSTATE ready_state_; |
338 | 328 |
339 | 329 |
340 // Popups are enabled | 330 // Popups are enabled |
341 bool enabled_popups_; | 331 bool enabled_popups_; |
342 | 332 |
343 // The value of src property keeping the current URL. | 333 // The value of src property keeping the current URL. |
344 std::string src_; | 334 std::string src_; |
| 335 // Used to fetch network resources when host network stack is in use. |
| 336 NPAPIUrlRequestManager url_fetcher_; |
345 }; | 337 }; |
346 | 338 |
347 #endif // CHROME_FRAME_CHROME_FRAME_NPAPI_H_ | 339 #endif // CHROME_FRAME_CHROME_FRAME_NPAPI_H_ |
OLD | NEW |