Chromium Code Reviews| 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 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 59 // Inform the BrowserPlugin that the guest has aborted loading a new page. | 61 // Inform the BrowserPlugin that the guest has aborted loading a new page. |
| 60 void LoadAbort(const GURL& url, bool is_top_level, const std::string& type); | 62 void LoadAbort(const GURL& url, bool is_top_level, const std::string& type); |
| 61 // Inform the BrowserPlugin that the guest has redirected a navigation. | 63 // Inform the BrowserPlugin that the guest has redirected a navigation. |
| 62 void LoadRedirect(const GURL& old_url, | 64 void LoadRedirect(const GURL& old_url, |
| 63 const GURL& new_url, | 65 const GURL& new_url, |
| 64 bool is_top_level); | 66 bool is_top_level); |
| 65 // Tells the BrowserPlugin to advance the focus to the next (or previous) | 67 // Tells the BrowserPlugin to advance the focus to the next (or previous) |
| 66 // element. | 68 // element. |
| 67 void AdvanceFocus(bool reverse); | 69 void AdvanceFocus(bool reverse); |
| 68 | 70 |
| 71 // Inform the BrowserPlugin that the guest's contentWindow is ready, | |
| 72 // and provide it with a routing ID to grab it. | |
| 73 void GuestContentWindowReady(int guest_routing_id); | |
| 74 | |
| 69 // Informs the BrowserPlugin that the guest has started/stopped accepting | 75 // Informs the BrowserPlugin that the guest has started/stopped accepting |
| 70 // touch events. | 76 // touch events. |
| 71 void SetAcceptTouchEvents(bool accept); | 77 void SetAcceptTouchEvents(bool accept); |
| 72 | 78 |
| 73 // Indicates whether there are any Javascript listeners attached to a | 79 // Indicates whether there are any Javascript listeners attached to a |
| 74 // provided event_name. | 80 // provided event_name. |
| 75 bool HasListeners(const std::string& event_name); | 81 bool HasListeners(const std::string& event_name); |
| 76 // Add a custom event listener to this BrowserPlugin instance. | 82 // Add a custom event listener to this BrowserPlugin instance. |
| 77 bool AddEventListener(const std::string& event_name, | 83 bool AddEventListener(const std::string& event_name, |
| 78 v8::Local<v8::Function> function); | 84 v8::Local<v8::Function> function); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 SkBitmap* sad_guest_; | 190 SkBitmap* sad_guest_; |
| 185 bool guest_crashed_; | 191 bool guest_crashed_; |
| 186 bool resize_pending_; | 192 bool resize_pending_; |
| 187 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; | 193 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
| 188 // True if we have ever sent a NavigateGuest message to the embedder. | 194 // True if we have ever sent a NavigateGuest message to the embedder. |
| 189 bool navigate_src_sent_; | 195 bool navigate_src_sent_; |
| 190 std::string src_; | 196 std::string src_; |
| 191 int process_id_; | 197 int process_id_; |
| 192 std::string storage_partition_id_; | 198 std::string storage_partition_id_; |
| 193 bool persist_storage_; | 199 bool persist_storage_; |
| 200 int guest_routing_id_; | |
|
Charlie Reis
2012/10/12 00:31:43
Maybe this should be content_window_routing_id_.
Fady Samuel
2012/10/12 18:07:53
Done.
| |
| 194 // Tracks the visibility of the browser plugin regardless of the whole | 201 // Tracks the visibility of the browser plugin regardless of the whole |
| 195 // embedder RenderView's visibility. | 202 // embedder RenderView's visibility. |
| 196 bool visible_; | 203 bool visible_; |
| 197 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 204 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 198 typedef std::map<std::string, EventListeners> EventListenerMap; | 205 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 199 EventListenerMap event_listener_map_; | 206 EventListenerMap event_listener_map_; |
| 200 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
| 201 base::SharedMemory shared_memory_; | 208 base::SharedMemory shared_memory_; |
| 202 #endif | 209 #endif |
| 203 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 210 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 204 }; | 211 }; |
| 205 | 212 |
| 206 } // namespace content | 213 } // namespace content |
| 207 | 214 |
| 208 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 215 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |