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 14 matching lines...) Expand all Loading... | |
25 public: | 25 public: |
26 // Called only by tests to clean up before we blow away the MockRenderProcess. | 26 // Called only by tests to clean up before we blow away the MockRenderProcess. |
27 void Cleanup(); | 27 void Cleanup(); |
28 | 28 |
29 // Get the src attribute value of the BrowserPlugin instance if the guest | 29 // Get the src attribute value of the BrowserPlugin instance if the guest |
30 // has not crashed. | 30 // has not crashed. |
31 std::string GetSrcAttribute() const; | 31 std::string GetSrcAttribute() const; |
32 // Set the src attribute value of the BrowserPlugin instance and reset | 32 // Set the src attribute value of the BrowserPlugin instance and reset |
33 // the guest_crashed_ flag. | 33 // the guest_crashed_ flag. |
34 void SetSrcAttribute(const std::string& src); | 34 void SetSrcAttribute(const std::string& src); |
35 // The partition idetifier string is stored as UTF-8. | |
Charlie Reis
2012/09/18 22:09:33
nit: identifier
nasko
2012/09/18 22:56:20
Done.
| |
36 std::string GetPartitionAttribute() const; | |
37 bool SetPartitionAttribute(const std::string& partition_id, | |
38 std::string& error_message); | |
Charlie Reis
2012/09/18 22:09:33
Please add a comment about |error_message|. Also,
nasko
2012/09/18 22:56:20
Done.
| |
35 | 39 |
36 // Inform the BrowserPlugin to update its backing store with the pixels in | 40 // Inform the BrowserPlugin to update its backing store with the pixels in |
37 // its damage buffer. | 41 // its damage buffer. |
38 void UpdateRect(int message_id, | 42 void UpdateRect(int message_id, |
39 const BrowserPluginMsg_UpdateRect_Params& params); | 43 const BrowserPluginMsg_UpdateRect_Params& params); |
40 // Inform the BrowserPlugin that its guest has crashed. | 44 // Inform the BrowserPlugin that its guest has crashed. |
41 void GuestCrashed(); | 45 void GuestCrashed(); |
42 // Informs the BrowserPlugin that the guest has navigated to a new URL. | 46 // Informs the BrowserPlugin that the guest has navigated to a new URL. |
43 void DidNavigate(const GURL& url); | 47 void DidNavigate(const GURL& url); |
44 // Tells the BrowserPlugin to advance the focus to the next (or previous) | 48 // 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... | |
109 const WebKit::WebPluginParams& params); | 113 const WebKit::WebPluginParams& params); |
110 | 114 |
111 virtual ~BrowserPlugin(); | 115 virtual ~BrowserPlugin(); |
112 | 116 |
113 int width() const { return plugin_rect_.width(); } | 117 int width() const { return plugin_rect_.width(); } |
114 int height() const { return plugin_rect_.height(); } | 118 int height() const { return plugin_rect_.height(); } |
115 | 119 |
116 // Virtual to allow for mocking in tests. | 120 // Virtual to allow for mocking in tests. |
117 virtual float GetDeviceScaleFactor() const; | 121 virtual float GetDeviceScaleFactor() const; |
118 | 122 |
119 // Parses the source URL of the browser plugin from the element's attributes | 123 // Parses the attributes of the browser plugin from the element's attributes |
120 // and outputs them. | 124 // and sets them appropriately. |
121 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, | 125 void ParseAttributes(const WebKit::WebPluginParams& params); |
122 std::string* src); | |
123 | 126 |
124 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 127 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
125 // is destroyed. | 128 // is destroyed. |
126 void RemoveEventListeners(); | 129 void RemoveEventListeners(); |
127 | 130 |
128 int instance_id_; | 131 int instance_id_; |
129 RenderViewImpl* render_view_; | 132 RenderViewImpl* render_view_; |
130 WebKit::WebPluginContainer* container_; | 133 WebKit::WebPluginContainer* container_; |
131 scoped_ptr<BrowserPluginBindings> bindings_; | 134 scoped_ptr<BrowserPluginBindings> bindings_; |
132 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 135 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
133 TransportDIB* damage_buffer_; | 136 TransportDIB* damage_buffer_; |
134 gfx::Rect plugin_rect_; | 137 gfx::Rect plugin_rect_; |
135 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 138 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
136 SkBitmap* sad_guest_; | 139 SkBitmap* sad_guest_; |
137 bool guest_crashed_; | 140 bool guest_crashed_; |
138 bool resize_pending_; | 141 bool resize_pending_; |
139 long long parent_frame_; | 142 long long parent_frame_; |
140 std::string src_; | 143 std::string src_; |
144 bool has_navigated_; | |
Charlie Reis
2012/09/18 22:09:33
FYI: This will end up being redundant with navigat
nasko
2012/09/18 22:56:20
Done.
| |
145 std::string storage_partition_id_; | |
146 bool persist_storage_; | |
141 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 147 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
142 typedef std::map<std::string, EventListeners> EventListenerMap; | 148 typedef std::map<std::string, EventListeners> EventListenerMap; |
143 EventListenerMap event_listener_map_; | 149 EventListenerMap event_listener_map_; |
144 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 150 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
145 }; | 151 }; |
146 | 152 |
147 } // namespace content | 153 } // namespace content |
148 | 154 |
149 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 155 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |