| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Set the maxwidth attribute value. | 52 // Set the maxwidth attribute value. |
| 53 void SetMaxWidthAttribute(int max_width); | 53 void SetMaxWidthAttribute(int max_width); |
| 54 // Get the minheight attribute value. | 54 // Get the minheight attribute value. |
| 55 int min_height_attribute() const { return min_height_; } | 55 int min_height_attribute() const { return min_height_; } |
| 56 // Set the minheight attribute value. | 56 // Set the minheight attribute value. |
| 57 void SetMinHeightAttribute(int minheight); | 57 void SetMinHeightAttribute(int minheight); |
| 58 // Get the minwidth attribute value. | 58 // Get the minwidth attribute value. |
| 59 int min_width_attribute() const { return min_width_; } | 59 int min_width_attribute() const { return min_width_; } |
| 60 // Set the minwidth attribute value. | 60 // Set the minwidth attribute value. |
| 61 void SetMinWidthAttribute(int minwidth); | 61 void SetMinWidthAttribute(int minwidth); |
| 62 bool InAutoSizeBounds(const gfx::Size& size) const; |
| 62 | 63 |
| 63 // Get the guest's DOMWindow proxy. | 64 // Get the guest's DOMWindow proxy. |
| 64 NPObject* GetContentWindow() const; | 65 NPObject* GetContentWindow() const; |
| 65 | 66 |
| 66 // Returns Chrome's process ID for the current guest. | 67 // Returns Chrome's process ID for the current guest. |
| 67 int process_id() const { return process_id_; } | 68 int process_id() const { return process_id_; } |
| 68 // The partition identifier string is stored as UTF-8. | 69 // The partition identifier string is stored as UTF-8. |
| 69 std::string GetPartitionAttribute() const; | 70 std::string GetPartitionAttribute() const; |
| 70 // Query whether the guest can navigate back to the previous entry. | 71 // Query whether the guest can navigate back to the previous entry. |
| 71 bool CanGoBack() const; | 72 bool CanGoBack() const; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 bool IsValidEvent(const std::string& event_name); | 220 bool IsValidEvent(const std::string& event_name); |
| 220 | 221 |
| 221 // Triggers the event-listeners for |event_name|. | 222 // Triggers the event-listeners for |event_name|. |
| 222 void TriggerEvent(const std::string& event_name, | 223 void TriggerEvent(const std::string& event_name, |
| 223 v8::Local<v8::Object>* event); | 224 v8::Local<v8::Object>* event); |
| 224 | 225 |
| 225 // Creates and maps transport dib. Overridden in tests. | 226 // Creates and maps transport dib. Overridden in tests. |
| 226 virtual TransportDIB* CreateTransportDIB(const size_t size); | 227 virtual TransportDIB* CreateTransportDIB(const size_t size); |
| 227 // Frees up the damage buffer. Overridden in tests. | 228 // Frees up the damage buffer. Overridden in tests. |
| 228 virtual void FreeDamageBuffer(); | 229 virtual void FreeDamageBuffer(); |
| 230 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state and |
| 231 // returns the newly allocated TransportDIB. |
| 232 TransportDIB* PopulateResizeGuestParameters( |
| 233 BrowserPluginHostMsg_ResizeGuest_Params* params, |
| 234 int view_width, int view_height); |
| 229 | 235 |
| 230 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. | 236 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. |
| 231 void PopulateAutoSizeParameters( | 237 void PopulateAutoSizeParameters( |
| 232 BrowserPluginHostMsg_AutoSize_Params* params) const; | 238 BrowserPluginHostMsg_AutoSize_Params* params); |
| 239 |
| 233 // Informs the guest of an updated autosize state. | 240 // Informs the guest of an updated autosize state. |
| 234 void UpdateGuestAutoSizeState() const; | 241 void UpdateGuestAutoSizeState(); |
| 242 |
| 243 // Informs the BrowserPlugin that guest has changed its size in autosize mode. |
| 244 void SizeChanged(const gfx::Size& old_view_size); |
| 235 | 245 |
| 236 int instance_id_; | 246 int instance_id_; |
| 237 base::WeakPtr<RenderViewImpl> render_view_; | 247 base::WeakPtr<RenderViewImpl> render_view_; |
| 238 // We cache the |render_view_|'s routing ID because we need it on destruction. | 248 // We cache the |render_view_|'s routing ID because we need it on destruction. |
| 239 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed | 249 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed |
| 240 // then we will attempt to access a NULL pointer. | 250 // then we will attempt to access a NULL pointer. |
| 241 int render_view_routing_id_; | 251 int render_view_routing_id_; |
| 242 WebKit::WebPluginContainer* container_; | 252 WebKit::WebPluginContainer* container_; |
| 243 scoped_ptr<BrowserPluginBindings> bindings_; | 253 scoped_ptr<BrowserPluginBindings> bindings_; |
| 244 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 254 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 262 bool persist_storage_; | 272 bool persist_storage_; |
| 263 int content_window_routing_id_; | 273 int content_window_routing_id_; |
| 264 bool focused_; | 274 bool focused_; |
| 265 // Tracks the visibility of the browser plugin regardless of the whole | 275 // Tracks the visibility of the browser plugin regardless of the whole |
| 266 // embedder RenderView's visibility. | 276 // embedder RenderView's visibility. |
| 267 bool visible_; | 277 bool visible_; |
| 268 typedef std::vector<v8::Local<v8::Function> > EventListenersLocal; | 278 typedef std::vector<v8::Local<v8::Function> > EventListenersLocal; |
| 269 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 279 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 270 typedef std::map<std::string, EventListeners> EventListenerMap; | 280 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 271 EventListenerMap event_listener_map_; | 281 EventListenerMap event_listener_map_; |
| 282 gfx::Size last_view_size_; |
| 283 bool size_changed_in_flight_; |
| 272 // Important: Do not add more history state here. | 284 // Important: Do not add more history state here. |
| 273 // We strongly discourage storing additional history state (such as page IDs) | 285 // We strongly discourage storing additional history state (such as page IDs) |
| 274 // in the embedder process, at the risk of having incorrect information that | 286 // in the embedder process, at the risk of having incorrect information that |
| 275 // can lead to broken back/forward logic in apps. | 287 // can lead to broken back/forward logic in apps. |
| 276 // It's also important that this state does not get modified by any logic in | 288 // It's also important that this state does not get modified by any logic in |
| 277 // the embedder process. It should only be updated in response to navigation | 289 // the embedder process. It should only be updated in response to navigation |
| 278 // events in the guest. No assumptions should be made about how the index | 290 // events in the guest. No assumptions should be made about how the index |
| 279 // will change after a navigation (e.g., for back, forward, or go), because | 291 // will change after a navigation (e.g., for back, forward, or go), because |
| 280 // the changes are not always obvious. For example, there is a maximum | 292 // the changes are not always obvious. For example, there is a maximum |
| 281 // number of entries and earlier ones will automatically be pruned. | 293 // number of entries and earlier ones will automatically be pruned. |
| 282 int current_nav_entry_index_; | 294 int current_nav_entry_index_; |
| 283 int nav_entry_count_; | 295 int nav_entry_count_; |
| 284 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 296 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 285 }; | 297 }; |
| 286 | 298 |
| 287 } // namespace content | 299 } // namespace content |
| 288 | 300 |
| 289 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 301 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |