Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class BrowserPluginCompositingHelper; | 29 class BrowserPluginCompositingHelper; |
| 30 class BrowserPluginManager; | 30 class BrowserPluginManager; |
| 31 class MockBrowserPlugin; | 31 class MockBrowserPlugin; |
| 32 | 32 |
| 33 class CONTENT_EXPORT BrowserPlugin : | 33 class CONTENT_EXPORT BrowserPlugin : |
| 34 NON_EXPORTED_BASE(public WebKit::WebPlugin) { | 34 NON_EXPORTED_BASE(public WebKit::WebPlugin) { |
| 35 public: | 35 public: |
| 36 RenderViewImpl* render_view() const { return render_view_.get(); } | 36 RenderViewImpl* render_view() const { return render_view_.get(); } |
| 37 int render_view_routing_id() const { return render_view_routing_id_; } | |
| 37 | 38 |
| 38 bool OnMessageReceived(const IPC::Message& msg); | 39 bool OnMessageReceived(const IPC::Message& msg); |
| 39 | 40 |
| 40 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value | 41 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value |
| 41 // |attribute_value|. | 42 // |attribute_value|. |
| 42 void UpdateDOMAttribute(const std::string& attribute_name, | 43 void UpdateDOMAttribute(const std::string& attribute_name, |
| 43 const std::string& attribute_value); | 44 const std::string& attribute_value); |
| 44 | 45 |
| 46 int instance_id() const { return instance_id_; } | |
| 47 | |
| 45 // Get the name attribute value. | 48 // Get the name attribute value. |
| 46 std::string name_attribute() const { return name_; } | 49 std::string name_attribute() const { return name_; } |
| 47 // Set the name attribute value. | 50 // Set the name attribute value. |
| 48 void SetNameAttribute(const std::string& name); | 51 void SetNameAttribute(const std::string& name); |
| 49 // Get the src attribute value of the BrowserPlugin instance. | 52 // Get the src attribute value of the BrowserPlugin instance. |
| 50 std::string src_attribute() const { return src_; } | 53 std::string src_attribute() const { return src_; } |
| 51 // Set the src attribute value of the BrowserPlugin instance. | 54 // Set the src attribute value of the BrowserPlugin instance. |
| 52 bool SetSrcAttribute(const std::string& src, std::string* error_message); | 55 bool SetSrcAttribute(const std::string& src, std::string* error_message); |
| 53 // Get the autosize attribute value. | 56 // Get the autosize attribute value. |
| 54 bool auto_size_attribute() const { return auto_size_; } | 57 bool auto_size_attribute() const { return auto_size_; } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 70 int min_width_attribute() const { return min_width_; } | 73 int min_width_attribute() const { return min_width_; } |
| 71 // Set the minwidth attribute value. | 74 // Set the minwidth attribute value. |
| 72 void SetMinWidthAttribute(int minwidth); | 75 void SetMinWidthAttribute(int minwidth); |
| 73 bool InAutoSizeBounds(const gfx::Size& size) const; | 76 bool InAutoSizeBounds(const gfx::Size& size) const; |
| 74 | 77 |
| 75 // Get the guest's DOMWindow proxy. | 78 // Get the guest's DOMWindow proxy. |
| 76 NPObject* GetContentWindow() const; | 79 NPObject* GetContentWindow() const; |
| 77 | 80 |
| 78 // Returns Chrome's process ID for the current guest. | 81 // Returns Chrome's process ID for the current guest. |
| 79 int process_id() const { return process_id_; } | 82 int process_id() const { return process_id_; } |
| 83 // Returns Chrome's route ID for the current guest. | |
| 84 int guest_route_id() const { return guest_route_id_; } | |
|
Matt Perry
2013/01/23 02:50:49
seems inconsistent to prefix this with guest_ when
Fady Samuel
2013/01/23 20:12:03
Renamed process_id() to guest_process_id(). There'
| |
| 85 | |
| 80 // The partition identifier string is stored as UTF-8. | 86 // The partition identifier string is stored as UTF-8. |
| 81 std::string GetPartitionAttribute() const; | 87 std::string GetPartitionAttribute() const; |
| 82 // Query whether the guest can navigate back to the previous entry. | 88 // Query whether the guest can navigate back to the previous entry. |
| 83 bool CanGoBack() const; | 89 bool CanGoBack() const; |
| 84 // Query whether the guest can navigation forward to the next entry. | 90 // Query whether the guest can navigation forward to the next entry. |
| 85 bool CanGoForward() const; | 91 bool CanGoForward() const; |
| 86 // This method can be successfully called only before the first navigation for | 92 // This method can be successfully called only before the first navigation for |
| 87 // this instance of BrowserPlugin. If an error occurs, the |error_message| is | 93 // this instance of BrowserPlugin. If an error occurs, the |error_message| is |
| 88 // set appropriately to indicate the failure reason. | 94 // set appropriately to indicate the failure reason. |
| 89 bool SetPartitionAttribute(const std::string& partition_id, | 95 bool SetPartitionAttribute(const std::string& partition_id, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 BrowserPlugin( | 183 BrowserPlugin( |
| 178 int instance_id, | 184 int instance_id, |
| 179 RenderViewImpl* render_view, | 185 RenderViewImpl* render_view, |
| 180 WebKit::WebFrame* frame, | 186 WebKit::WebFrame* frame, |
| 181 const WebKit::WebPluginParams& params); | 187 const WebKit::WebPluginParams& params); |
| 182 | 188 |
| 183 virtual ~BrowserPlugin(); | 189 virtual ~BrowserPlugin(); |
| 184 | 190 |
| 185 int width() const { return plugin_rect_.width(); } | 191 int width() const { return plugin_rect_.width(); } |
| 186 int height() const { return plugin_rect_.height(); } | 192 int height() const { return plugin_rect_.height(); } |
| 187 int instance_id() const { return instance_id_; } | |
| 188 int render_view_routing_id() const { return render_view_routing_id_; } | |
| 189 BrowserPluginManager* browser_plugin_manager() const { | 193 BrowserPluginManager* browser_plugin_manager() const { |
| 190 return browser_plugin_manager_; | 194 return browser_plugin_manager_; |
| 191 } | 195 } |
| 192 | 196 |
| 193 // Virtual to allow for mocking in tests. | 197 // Virtual to allow for mocking in tests. |
| 194 virtual float GetDeviceScaleFactor() const; | 198 virtual float GetDeviceScaleFactor() const; |
| 195 | 199 |
| 196 // Parses the attributes of the browser plugin from the element's attributes | 200 // Parses the attributes of the browser plugin from the element's attributes |
| 197 // and sets them appropriately. | 201 // and sets them appropriately. |
| 198 void ParseAttributes(const WebKit::WebPluginParams& params); | 202 void ParseAttributes(const WebKit::WebPluginParams& params); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; | 296 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
| 293 // True if we have ever sent a NavigateGuest message to the embedder. | 297 // True if we have ever sent a NavigateGuest message to the embedder. |
| 294 bool navigate_src_sent_; | 298 bool navigate_src_sent_; |
| 295 std::string src_; | 299 std::string src_; |
| 296 bool auto_size_; | 300 bool auto_size_; |
| 297 int max_height_; | 301 int max_height_; |
| 298 int max_width_; | 302 int max_width_; |
| 299 int min_height_; | 303 int min_height_; |
| 300 int min_width_; | 304 int min_width_; |
| 301 int process_id_; | 305 int process_id_; |
| 306 int guest_route_id_; | |
| 302 std::string storage_partition_id_; | 307 std::string storage_partition_id_; |
| 303 bool persist_storage_; | 308 bool persist_storage_; |
| 304 bool valid_partition_id_; | 309 bool valid_partition_id_; |
| 305 int content_window_routing_id_; | 310 int content_window_routing_id_; |
| 306 bool plugin_focused_; | 311 bool plugin_focused_; |
| 307 // Tracks the visibility of the browser plugin regardless of the whole | 312 // Tracks the visibility of the browser plugin regardless of the whole |
| 308 // embedder RenderView's visibility. | 313 // embedder RenderView's visibility. |
| 309 bool visible_; | 314 bool visible_; |
| 310 std::string name_; | 315 std::string name_; |
| 311 | 316 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 335 // Used for HW compositing. | 340 // Used for HW compositing. |
| 336 bool compositing_enabled_; | 341 bool compositing_enabled_; |
| 337 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; | 342 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; |
| 338 | 343 |
| 339 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 344 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 340 }; | 345 }; |
| 341 | 346 |
| 342 } // namespace content | 347 } // namespace content |
| 343 | 348 |
| 344 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 349 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |