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 has a list of guests it manages. | 5 // A BrowserPluginEmbedder has a list of guests it manages. |
6 // In the beginning when a renderer sees one or more guests (BrowserPlugin | 6 // In the beginning when a renderer sees one or more guests (BrowserPlugin |
7 // instance(s)) and there is a request to navigate to them, the WebContents for | 7 // instance(s)) and there is a request to navigate to them, the WebContents for |
8 // that renderer creates a BrowserPluginEmbedder for itself. The | 8 // that renderer creates a BrowserPluginEmbedder for itself. The |
9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one | 9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one |
10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that | 10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 typedef std::map<int, WebContents*> ContainerInstanceMap; | 57 typedef std::map<int, WebContents*> ContainerInstanceMap; |
58 | 58 |
59 virtual ~BrowserPluginEmbedder(); | 59 virtual ~BrowserPluginEmbedder(); |
60 | 60 |
61 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents, | 61 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents, |
62 RenderViewHost* render_view_host); | 62 RenderViewHost* render_view_host); |
63 | 63 |
64 // Navigates in a guest (new or existing). | 64 // Navigates in a guest (new or existing). |
65 void NavigateGuest(RenderViewHost* render_view_host, | 65 void NavigateGuest(RenderViewHost* render_view_host, |
66 int instance_id, | 66 int instance_id, |
67 int64 frame_id, | |
68 const std::string& src, | 67 const std::string& src, |
69 const gfx::Size& size); | 68 const gfx::Size& size); |
70 void Stop(int instance_id); | 69 void Stop(int instance_id); |
71 void Reload(int instance_id); | 70 void Reload(int instance_id); |
72 | 71 |
73 // WebContentsObserver implementation. | 72 // WebContentsObserver implementation. |
74 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; | 73 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; |
75 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 74 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
76 | 75 |
77 // NotificationObserver method override. | 76 // NotificationObserver method override. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 private: | 109 private: |
111 friend class TestBrowserPluginEmbedder; | 110 friend class TestBrowserPluginEmbedder; |
112 | 111 |
113 BrowserPluginEmbedder(WebContentsImpl* web_contents, | 112 BrowserPluginEmbedder(WebContentsImpl* web_contents, |
114 RenderViewHost* render_view_host); | 113 RenderViewHost* render_view_host); |
115 | 114 |
116 // Returns a guest browser plugin delegate by its container ID specified | 115 // Returns a guest browser plugin delegate by its container ID specified |
117 // in BrowserPlugin. | 116 // in BrowserPlugin. |
118 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const; | 117 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const; |
119 // Adds a new guest web_contents to the embedder (overridable in test). | 118 // Adds a new guest web_contents to the embedder (overridable in test). |
120 virtual void AddGuest(int instance_id, | 119 virtual void AddGuest(int instance_id, WebContents* guest_web_contents); |
121 WebContents* guest_web_contents, | |
122 int64 frame_id); | |
123 void DestroyGuestByInstanceID(int instance_id); | 120 void DestroyGuestByInstanceID(int instance_id); |
124 void DestroyGuests(); | 121 void DestroyGuests(); |
125 | 122 |
126 // Called when visiblity of web_contents changes, so the embedder will | 123 // Called when visiblity of web_contents changes, so the embedder will |
127 // show/hide its guest. | 124 // show/hide its guest. |
128 void WebContentsVisibilityChanged(bool visible); | 125 void WebContentsVisibilityChanged(bool visible); |
129 | 126 |
130 // Static factory instance (always NULL for non-test). | 127 // Static factory instance (always NULL for non-test). |
131 static BrowserPluginHostFactory* factory_; | 128 static BrowserPluginHostFactory* factory_; |
132 | 129 |
133 // A scoped container for notification registries. | 130 // A scoped container for notification registries. |
134 NotificationRegistrar registrar_; | 131 NotificationRegistrar registrar_; |
135 | 132 |
136 // Contains guests' WebContents, mapping from their instance ids. | 133 // Contains guests' WebContents, mapping from their instance ids. |
137 ContainerInstanceMap guest_web_contents_by_instance_id_; | 134 ContainerInstanceMap guest_web_contents_by_instance_id_; |
138 RenderViewHost* render_view_host_; | 135 RenderViewHost* render_view_host_; |
139 | 136 |
140 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 137 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
141 }; | 138 }; |
142 | 139 |
143 } // namespace content | 140 } // namespace content |
144 | 141 |
145 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 142 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |