| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/public/web/WebPlugin.h" | 8 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Returns whether this BrowserPlugin has requested an instance ID. | 101 // Returns whether this BrowserPlugin has requested an instance ID. |
| 102 bool HasNavigated() const; | 102 bool HasNavigated() const; |
| 103 // Returns whether this BrowserPlugin has allocated an instance ID. | 103 // Returns whether this BrowserPlugin has allocated an instance ID. |
| 104 bool HasGuestInstanceID() const; | 104 bool HasGuestInstanceID() const; |
| 105 | 105 |
| 106 // Attaches the window identified by |window_id| to the the given node | 106 // Attaches the window identified by |window_id| to the the given node |
| 107 // encapsulating a BrowserPlugin. | 107 // encapsulating a BrowserPlugin. |
| 108 static bool AttachWindowTo(const WebKit::WebNode& node, | 108 static bool AttachWindowTo(const WebKit::WebNode& node, |
| 109 int window_id); | 109 int window_id); |
| 110 | 110 |
| 111 // Query whether the guest can navigate back to the previous entry. | |
| 112 bool CanGoBack() const; | |
| 113 // Query whether the guest can navigation forward to the next entry. | |
| 114 bool CanGoForward() const; | |
| 115 | |
| 116 // Informs the guest of an updated focus state. | 111 // Informs the guest of an updated focus state. |
| 117 void UpdateGuestFocusState(); | 112 void UpdateGuestFocusState(); |
| 118 // Indicates whether the guest should be focused. | 113 // Indicates whether the guest should be focused. |
| 119 bool ShouldGuestBeFocused() const; | 114 bool ShouldGuestBeFocused() const; |
| 120 | 115 |
| 121 // Embedder's device scale factor changed, we need to update the guest | 116 // Embedder's device scale factor changed, we need to update the guest |
| 122 // renderer. | 117 // renderer. |
| 123 void UpdateDeviceScaleFactor(float device_scale_factor); | 118 void UpdateDeviceScaleFactor(float device_scale_factor); |
| 124 | 119 |
| 125 // Tells the BrowserPlugin to tell the guest to navigate to the previous | |
| 126 // navigation entry in the navigation history. | |
| 127 void Back(); | |
| 128 // Tells the BrowserPlugin to tell the guest to navigate to the next | |
| 129 // navigation entry in the navigation history. | |
| 130 void Forward(); | |
| 131 // Tells the BrowserPlugin to tell the guest to navigate to a position | |
| 132 // relative to the current index in its navigation history. | |
| 133 void Go(int relativeIndex); | |
| 134 // Tells the BrowserPlugin to terminate the guest process. | 120 // Tells the BrowserPlugin to terminate the guest process. |
| 135 void TerminateGuest(); | 121 void TerminateGuest(); |
| 136 | 122 |
| 137 // A request from JavaScript has been made to stop the loading of the page. | 123 // A request from JavaScript has been made to stop the loading of the page. |
| 138 void Stop(); | 124 void Stop(); |
| 139 // A request from JavaScript has been made to reload the page. | 125 // A request from JavaScript has been made to reload the page. |
| 140 void Reload(); | 126 void Reload(); |
| 141 // A request to enable hardware compositing. | 127 // A request to enable hardware compositing. |
| 142 void EnableCompositing(bool enable); | 128 void EnableCompositing(bool enable); |
| 143 // A request from content client to track lifetime of a JavaScript object | 129 // A request from content client to track lifetime of a JavaScript object |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 typedef std::pair<int, base::WeakPtr<BrowserPlugin> > | 414 typedef std::pair<int, base::WeakPtr<BrowserPlugin> > |
| 429 AliveV8PermissionRequestItem; | 415 AliveV8PermissionRequestItem; |
| 430 std::map<int, AliveV8PermissionRequestItem*> | 416 std::map<int, AliveV8PermissionRequestItem*> |
| 431 alive_v8_permission_request_objects_; | 417 alive_v8_permission_request_objects_; |
| 432 | 418 |
| 433 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 419 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
| 434 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 420 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
| 435 // avoid accessing the RenderViewImpl. | 421 // avoid accessing the RenderViewImpl. |
| 436 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 422 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
| 437 | 423 |
| 438 // Important: Do not add more history state here. | |
| 439 // We strongly discourage storing additional history state (such as page IDs) | |
| 440 // in the embedder process, at the risk of having incorrect information that | |
| 441 // can lead to broken back/forward logic in apps. | |
| 442 // It's also important that this state does not get modified by any logic in | |
| 443 // the embedder process. It should only be updated in response to navigation | |
| 444 // events in the guest. No assumptions should be made about how the index | |
| 445 // will change after a navigation (e.g., for back, forward, or go), because | |
| 446 // the changes are not always obvious. For example, there is a maximum | |
| 447 // number of entries and earlier ones will automatically be pruned. | |
| 448 int current_nav_entry_index_; | |
| 449 int nav_entry_count_; | |
| 450 | |
| 451 // Used for HW compositing. | 424 // Used for HW compositing. |
| 452 bool compositing_enabled_; | 425 bool compositing_enabled_; |
| 453 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; | 426 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; |
| 454 | 427 |
| 455 // Used to identify the plugin to WebBindings. | 428 // Used to identify the plugin to WebBindings. |
| 456 scoped_ptr<struct _NPP> npp_; | 429 scoped_ptr<struct _NPP> npp_; |
| 457 | 430 |
| 458 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 431 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
| 459 // get called after BrowserPlugin has been destroyed. | 432 // get called after BrowserPlugin has been destroyed. |
| 460 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 433 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
| 461 | 434 |
| 462 std::vector<EditCommand> edit_commands_; | 435 std::vector<EditCommand> edit_commands_; |
| 463 | 436 |
| 464 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 437 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 465 }; | 438 }; |
| 466 | 439 |
| 467 } // namespace content | 440 } // namespace content |
| 468 | 441 |
| 469 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 442 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |