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 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's | 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's |
6 // embedder that are not directed at any particular existing guest process. | 6 // embedder that are not directed at any particular existing guest process. |
7 // In the beginning, when a BrowserPlugin instance in the embedder renderer | 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer |
8 // process requests an initial navigation, the WebContents for that renderer | 8 // process requests an initial navigation, the WebContents for that renderer |
9 // renderer creates a BrowserPluginEmbedder for itself. The | 9 // renderer creates a BrowserPluginEmbedder for itself. The |
10 // BrowserPluginEmbedder, in turn, forwards the requests to a | 10 // BrowserPluginEmbedder, in turn, forwards the requests to a |
(...skipping 27 matching lines...) Expand all Loading... |
38 class WebContentsImpl; | 38 class WebContentsImpl; |
39 struct NativeWebKeyboardEvent; | 39 struct NativeWebKeyboardEvent; |
40 | 40 |
41 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { | 41 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { |
42 public: | 42 public: |
43 virtual ~BrowserPluginEmbedder(); | 43 virtual ~BrowserPluginEmbedder(); |
44 | 44 |
45 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); | 45 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); |
46 | 46 |
47 // Returns this embedder's WebContentsImpl. | 47 // Returns this embedder's WebContentsImpl. |
48 WebContentsImpl* GetWebContents(); | 48 WebContentsImpl* GetWebContents() const; |
49 | 49 |
50 // Called when embedder's |rwh| has sent screen rects to renderer. | 50 // Called when embedder's |rwh| has sent screen rects to renderer. |
51 void DidSendScreenRects(); | 51 void DidSendScreenRects(); |
52 | 52 |
53 // Called when embedder's WebContentsImpl has unhandled keyboard input. | 53 // Called when embedder's WebContentsImpl has unhandled keyboard input. |
54 // Returns whether the BrowserPlugin has handled the keyboard event. | 54 // Returns whether the BrowserPlugin has handled the keyboard event. |
55 // Currently we are only interested in checking for the escape key to | 55 // Currently we are only interested in checking for the escape key to |
56 // unlock hte guest's pointer lock. | 56 // unlock hte guest's pointer lock. |
57 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 57 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
58 | 58 |
(...skipping 20 matching lines...) Expand all Loading... |
79 | 79 |
80 void StartDrag(BrowserPluginGuest* guest); | 80 void StartDrag(BrowserPluginGuest* guest); |
81 | 81 |
82 // Sends EndSystemDrag message to the guest that initiated the last drag/drop | 82 // Sends EndSystemDrag message to the guest that initiated the last drag/drop |
83 // operation, if there's any. | 83 // operation, if there's any. |
84 void SystemDragEnded(); | 84 void SystemDragEnded(); |
85 | 85 |
86 private: | 86 private: |
87 friend class TestBrowserPluginEmbedder; | 87 friend class TestBrowserPluginEmbedder; |
88 | 88 |
89 BrowserPluginEmbedder(WebContentsImpl* web_contents); | 89 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
90 | 90 |
91 BrowserPluginGuestManager* GetBrowserPluginGuestManager(); | 91 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
92 | 92 |
93 bool DidSendScreenRectsCallback(BrowserPluginGuest* guest); | 93 bool DidSendScreenRectsCallback(BrowserPluginGuest* guest); |
94 | 94 |
95 bool SetZoomLevelCallback(double level, BrowserPluginGuest* guest); | 95 bool SetZoomLevelCallback(double level, BrowserPluginGuest* guest); |
96 | 96 |
97 bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, | 97 bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, |
98 BrowserPluginGuest* guest); | 98 BrowserPluginGuest* guest); |
99 | 99 |
100 // Message handlers. | 100 // Message handlers. |
101 | 101 |
(...skipping 12 matching lines...) Expand all Loading... |
114 // handle a race condition when dropping onto the guest that started the drag | 114 // handle a race condition when dropping onto the guest that started the drag |
115 // (the race is that the dragend message arrives before the drop message so | 115 // (the race is that the dragend message arrives before the drop message so |
116 // the drop never takes place). | 116 // the drop never takes place). |
117 // crbug.com/233571 | 117 // crbug.com/233571 |
118 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 118 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
119 | 119 |
120 // Pointer to the guest that started the drag, used to forward necessary drag | 120 // Pointer to the guest that started the drag, used to forward necessary drag |
121 // status messages to the correct guest. | 121 // status messages to the correct guest. |
122 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 122 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
123 | 123 |
| 124 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
| 125 |
124 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 126 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
125 }; | 127 }; |
126 | 128 |
127 } // namespace content | 129 } // namespace content |
128 | 130 |
129 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 131 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |