| 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 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 // Called only by tests to clean up before we blow away the MockRenderProcess. | 29 // Called only by tests to clean up before we blow away the MockRenderProcess. |
| 30 void Cleanup(); | 30 void Cleanup(); |
| 31 | 31 |
| 32 // Get the src attribute value of the BrowserPlugin instance if the guest | 32 // Get the src attribute value of the BrowserPlugin instance if the guest |
| 33 // has not crashed. | 33 // has not crashed. |
| 34 std::string GetSrcAttribute() const; | 34 std::string GetSrcAttribute() const; |
| 35 // Set the src attribute value of the BrowserPlugin instance and reset | 35 // Set the src attribute value of the BrowserPlugin instance and reset |
| 36 // the guest_crashed_ flag. | 36 // the guest_crashed_ flag. |
| 37 void SetSrcAttribute(const std::string& src); | 37 void SetSrcAttribute(const std::string& src); |
| 38 // The partition identifier string is stored as UTF-8. |
| 39 std::string GetPartitionAttribute() const; |
| 40 // This method can be successfully called only before the first navigation for |
| 41 // this instance of BrowserPlugin. If an error occurs, the |error_message| is |
| 42 // set appropriately to indicate the failure reason. |
| 43 bool SetPartitionAttribute(const std::string& partition_id, |
| 44 std::string& error_message); |
| 38 | 45 |
| 39 // Inform the BrowserPlugin to update its backing store with the pixels in | 46 // Inform the BrowserPlugin to update its backing store with the pixels in |
| 40 // its damage buffer. | 47 // its damage buffer. |
| 41 void UpdateRect(int message_id, | 48 void UpdateRect(int message_id, |
| 42 const BrowserPluginMsg_UpdateRect_Params& params); | 49 const BrowserPluginMsg_UpdateRect_Params& params); |
| 43 // Inform the BrowserPlugin that its guest has crashed. | 50 // Inform the BrowserPlugin that its guest has crashed. |
| 44 void GuestCrashed(); | 51 void GuestCrashed(); |
| 45 // Informs the BrowserPlugin that the guest has navigated to a new URL. | 52 // Informs the BrowserPlugin that the guest has navigated to a new URL. |
| 46 void DidNavigate(const GURL& url); | 53 void DidNavigate(const GURL& url); |
| 47 // Tells the BrowserPlugin to advance the focus to the next (or previous) | 54 // Tells the BrowserPlugin to advance the focus to the next (or previous) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const WebKit::WebPluginParams& params); | 119 const WebKit::WebPluginParams& params); |
| 113 | 120 |
| 114 virtual ~BrowserPlugin(); | 121 virtual ~BrowserPlugin(); |
| 115 | 122 |
| 116 int width() const { return plugin_rect_.width(); } | 123 int width() const { return plugin_rect_.width(); } |
| 117 int height() const { return plugin_rect_.height(); } | 124 int height() const { return plugin_rect_.height(); } |
| 118 | 125 |
| 119 // Virtual to allow for mocking in tests. | 126 // Virtual to allow for mocking in tests. |
| 120 virtual float GetDeviceScaleFactor() const; | 127 virtual float GetDeviceScaleFactor() const; |
| 121 | 128 |
| 122 // Parses the source URL of the browser plugin from the element's attributes | 129 // Parses the attributes of the browser plugin from the element's attributes |
| 123 // and outputs them. | 130 // and sets them appropriately. |
| 124 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, | 131 void ParseAttributes(const WebKit::WebPluginParams& params); |
| 125 std::string* src); | |
| 126 | 132 |
| 127 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 133 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
| 128 // is destroyed. | 134 // is destroyed. |
| 129 void RemoveEventListeners(); | 135 void RemoveEventListeners(); |
| 130 | 136 |
| 131 int instance_id_; | 137 int instance_id_; |
| 132 RenderViewImpl* render_view_; | 138 RenderViewImpl* render_view_; |
| 133 WebKit::WebPluginContainer* container_; | 139 WebKit::WebPluginContainer* container_; |
| 134 scoped_ptr<BrowserPluginBindings> bindings_; | 140 scoped_ptr<BrowserPluginBindings> bindings_; |
| 135 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 141 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
| 136 TransportDIB* damage_buffer_; | 142 TransportDIB* damage_buffer_; |
| 137 gfx::Rect plugin_rect_; | 143 gfx::Rect plugin_rect_; |
| 138 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 144 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
| 139 SkBitmap* sad_guest_; | 145 SkBitmap* sad_guest_; |
| 140 bool guest_crashed_; | 146 bool guest_crashed_; |
| 141 bool resize_pending_; | 147 bool resize_pending_; |
| 142 // True if we have ever sent a NavigateGuest message to the embedder. | 148 // True if we have ever sent a NavigateGuest message to the embedder. |
| 143 bool navigate_src_sent_; | 149 bool navigate_src_sent_; |
| 144 int64 parent_frame_; | 150 int64 parent_frame_; |
| 145 std::string src_; | 151 std::string src_; |
| 152 std::string storage_partition_id_; |
| 153 bool persist_storage_; |
| 146 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 154 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 147 typedef std::map<std::string, EventListeners> EventListenerMap; | 155 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 148 EventListenerMap event_listener_map_; | 156 EventListenerMap event_listener_map_; |
| 149 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
| 150 base::SharedMemory shared_memory_; | 158 base::SharedMemory shared_memory_; |
| 151 #endif | 159 #endif |
| 152 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 160 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 153 }; | 161 }; |
| 154 | 162 |
| 155 } // namespace content | 163 } // namespace content |
| 156 | 164 |
| 157 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 165 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |