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