OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
7 | 7 |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 // Called only by tests to clean up before we blow away the MockRenderProcess. | 30 // Called only by tests to clean up before we blow away the MockRenderProcess. |
31 void Cleanup(); | 31 void Cleanup(); |
32 | 32 |
33 // Get the src attribute value of the BrowserPlugin instance if the guest | 33 // Get the src attribute value of the BrowserPlugin instance if the guest |
34 // has not crashed. | 34 // has not crashed. |
35 std::string GetSrcAttribute() const; | 35 std::string GetSrcAttribute() const; |
36 // Set the src attribute value of the BrowserPlugin instance and reset | 36 // Set the src attribute value of the BrowserPlugin instance and reset |
37 // the guest_crashed_ flag. | 37 // the guest_crashed_ flag. |
38 void SetSrcAttribute(const std::string& src); | 38 void SetSrcAttribute(const std::string& src); |
| 39 // Get the guest's DOMWindow proxy. |
| 40 NPObject* GetContentWindow() const; |
39 // Returns Chrome's process ID for the current guest. | 41 // Returns Chrome's process ID for the current guest. |
40 int process_id() const { return process_id_; } | 42 int process_id() const { return process_id_; } |
41 // The partition identifier string is stored as UTF-8. | 43 // The partition identifier string is stored as UTF-8. |
42 std::string GetPartitionAttribute() const; | 44 std::string GetPartitionAttribute() const; |
43 // This method can be successfully called only before the first navigation for | 45 // This method can be successfully called only before the first navigation for |
44 // this instance of BrowserPlugin. If an error occurs, the |error_message| is | 46 // this instance of BrowserPlugin. If an error occurs, the |error_message| is |
45 // set appropriately to indicate the failure reason. | 47 // set appropriately to indicate the failure reason. |
46 bool SetPartitionAttribute(const std::string& partition_id, | 48 bool SetPartitionAttribute(const std::string& partition_id, |
47 std::string& error_message); | 49 std::string& error_message); |
48 | 50 |
49 // Inform the BrowserPlugin to update its backing store with the pixels in | 51 // Inform the BrowserPlugin to update its backing store with the pixels in |
50 // its damage buffer. | 52 // its damage buffer. |
51 void UpdateRect(int message_id, | 53 void UpdateRect(int message_id, |
52 const BrowserPluginMsg_UpdateRect_Params& params); | 54 const BrowserPluginMsg_UpdateRect_Params& params); |
53 // Inform the BrowserPlugin that its guest has crashed. | 55 // Inform the BrowserPlugin that its guest has crashed. |
54 void GuestCrashed(); | 56 void GuestCrashed(); |
55 // Informs the BrowserPlugin that the guest has navigated to a new URL. | 57 // Informs the BrowserPlugin that the guest has navigated to a new URL. |
56 void DidNavigate(const GURL& url, int process_id); | 58 void DidNavigate(const GURL& url, int process_id); |
57 // Tells the BrowserPlugin to advance the focus to the next (or previous) | 59 // Tells the BrowserPlugin to advance the focus to the next (or previous) |
58 // element. | 60 // element. |
59 void AdvanceFocus(bool reverse); | 61 void AdvanceFocus(bool reverse); |
| 62 // Inform the BrowserPlugin of a message posted from its guest. |
| 63 void ReceiveMessage(int source_routing_id, |
| 64 const string16& source_origin, |
| 65 int source_frame_id, |
| 66 const string16& data); |
| 67 // Inform the BrowserPlugin that the guest's contentWindow is ready, |
| 68 // and provide it with a routing ID to grab it. |
| 69 void GuestContentWindowReady(int guest_routing_id); |
60 | 70 |
61 // Informs the BrowserPlugin that the guest has started/stopped accepting | 71 // Informs the BrowserPlugin that the guest has started/stopped accepting |
62 // touch events. | 72 // touch events. |
63 void SetAcceptTouchEvents(bool accept); | 73 void SetAcceptTouchEvents(bool accept); |
64 | 74 |
65 // Indicates whether there are any Javascript listeners attached to a | 75 // Indicates whether there are any Javascript listeners attached to a |
66 // provided event_name. | 76 // provided event_name. |
67 bool HasListeners(const std::string& event_name); | 77 bool HasListeners(const std::string& event_name); |
68 // Add a custom event listener to this BrowserPlugin instance. | 78 // Add a custom event listener to this BrowserPlugin instance. |
69 bool AddEventListener(const std::string& event_name, | 79 bool AddEventListener(const std::string& event_name, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 SkBitmap* sad_guest_; | 184 SkBitmap* sad_guest_; |
175 bool guest_crashed_; | 185 bool guest_crashed_; |
176 bool resize_pending_; | 186 bool resize_pending_; |
177 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; | 187 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
178 // True if we have ever sent a NavigateGuest message to the embedder. | 188 // True if we have ever sent a NavigateGuest message to the embedder. |
179 bool navigate_src_sent_; | 189 bool navigate_src_sent_; |
180 std::string src_; | 190 std::string src_; |
181 int process_id_; | 191 int process_id_; |
182 std::string storage_partition_id_; | 192 std::string storage_partition_id_; |
183 bool persist_storage_; | 193 bool persist_storage_; |
| 194 int guest_routing_id_; |
184 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 195 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
185 typedef std::map<std::string, EventListeners> EventListenerMap; | 196 typedef std::map<std::string, EventListeners> EventListenerMap; |
186 EventListenerMap event_listener_map_; | 197 EventListenerMap event_listener_map_; |
187 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
188 base::SharedMemory shared_memory_; | 199 base::SharedMemory shared_memory_; |
189 #endif | 200 #endif |
190 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 201 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
191 }; | 202 }; |
192 | 203 |
193 } // namespace content | 204 } // namespace content |
194 | 205 |
195 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 206 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |