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 identifier string is stored as UTF-8. | |
36 std::string GetPartitionAttribute() const; | |
37 // This method can successfully called only before the first navigation for | |
Charlie Reis
2012/09/19 00:06:31
nit: can be
nasko
2012/09/19 17:03:23
Done.
| |
38 // the instance of BrowserPlugin. If an error occurs, the |error_message| is | |
Charlie Reis
2012/09/19 00:06:31
nit: this instance
Also, we should mention that i
nasko
2012/09/19 17:03:23
Done.
| |
39 // set appropriately to indicate the failure reason. | |
40 bool SetPartitionAttribute(const std::string& partition_id, | |
41 std::string& error_message); | |
35 | 42 |
36 // Inform the BrowserPlugin to update its backing store with the pixels in | 43 // Inform the BrowserPlugin to update its backing store with the pixels in |
37 // its damage buffer. | 44 // its damage buffer. |
38 void UpdateRect(int message_id, | 45 void UpdateRect(int message_id, |
39 const BrowserPluginMsg_UpdateRect_Params& params); | 46 const BrowserPluginMsg_UpdateRect_Params& params); |
40 // Inform the BrowserPlugin that its guest has crashed. | 47 // Inform the BrowserPlugin that its guest has crashed. |
41 void GuestCrashed(); | 48 void GuestCrashed(); |
42 // Informs the BrowserPlugin that the guest has navigated to a new URL. | 49 // Informs the BrowserPlugin that the guest has navigated to a new URL. |
43 void DidNavigate(const GURL& url); | 50 void DidNavigate(const GURL& url); |
44 // Tells the BrowserPlugin to advance the focus to the next (or previous) | 51 // 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); | 116 const WebKit::WebPluginParams& params); |
110 | 117 |
111 virtual ~BrowserPlugin(); | 118 virtual ~BrowserPlugin(); |
112 | 119 |
113 int width() const { return plugin_rect_.width(); } | 120 int width() const { return plugin_rect_.width(); } |
114 int height() const { return plugin_rect_.height(); } | 121 int height() const { return plugin_rect_.height(); } |
115 | 122 |
116 // Virtual to allow for mocking in tests. | 123 // Virtual to allow for mocking in tests. |
117 virtual float GetDeviceScaleFactor() const; | 124 virtual float GetDeviceScaleFactor() const; |
118 | 125 |
119 // Parses the source URL of the browser plugin from the element's attributes | 126 // Parses the attributes of the browser plugin from the element's attributes |
120 // and outputs them. | 127 // and sets them appropriately. |
121 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, | 128 void ParseAttributes(const WebKit::WebPluginParams& params); |
122 std::string* src); | |
123 | 129 |
124 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 130 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
125 // is destroyed. | 131 // is destroyed. |
126 void RemoveEventListeners(); | 132 void RemoveEventListeners(); |
127 | 133 |
128 int instance_id_; | 134 int instance_id_; |
129 RenderViewImpl* render_view_; | 135 RenderViewImpl* render_view_; |
130 WebKit::WebPluginContainer* container_; | 136 WebKit::WebPluginContainer* container_; |
131 scoped_ptr<BrowserPluginBindings> bindings_; | 137 scoped_ptr<BrowserPluginBindings> bindings_; |
132 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 138 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
133 TransportDIB* damage_buffer_; | 139 TransportDIB* damage_buffer_; |
134 gfx::Rect plugin_rect_; | 140 gfx::Rect plugin_rect_; |
135 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 141 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
136 SkBitmap* sad_guest_; | 142 SkBitmap* sad_guest_; |
137 bool guest_crashed_; | 143 bool guest_crashed_; |
138 bool resize_pending_; | 144 bool resize_pending_; |
139 long long parent_frame_; | 145 long long parent_frame_; |
140 std::string src_; | 146 std::string src_; |
147 // TODO(nasko): This member could potentially be equivalent to | |
148 // navigate_src_sent_ from an upcoming CL. Remove it if this is the case once | |
149 // the new code lands. | |
150 bool has_navigated_; | |
151 std::string storage_partition_id_; | |
152 bool persist_storage_; | |
Charlie Reis
2012/09/19 00:06:31
Is it worth exposing this separately, so that call
nasko
2012/09/19 17:03:23
I'm not sure if we will have internal callers in R
| |
141 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 153 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
142 typedef std::map<std::string, EventListeners> EventListenerMap; | 154 typedef std::map<std::string, EventListeners> EventListenerMap; |
143 EventListenerMap event_listener_map_; | 155 EventListenerMap event_listener_map_; |
144 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 156 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
145 }; | 157 }; |
146 | 158 |
147 } // namespace content | 159 } // namespace content |
148 | 160 |
149 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 161 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |