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 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 guest = guest_web_contents->GetBrowserPluginGuest(); | 96 guest = guest_web_contents->GetBrowserPluginGuest(); |
97 guest->set_embedder_render_process_host( | 97 guest->set_embedder_render_process_host( |
98 render_view_host->GetProcess()); | 98 render_view_host->GetProcess()); |
99 | 99 |
100 guest_web_contents->GetMutableRendererPrefs()-> | 100 guest_web_contents->GetMutableRendererPrefs()-> |
101 throttle_input_events = false; | 101 throttle_input_events = false; |
102 AddGuest(instance_id, guest_web_contents, frame_id); | 102 AddGuest(instance_id, guest_web_contents, frame_id); |
103 guest_web_contents->SetDelegate(guest); | 103 guest_web_contents->SetDelegate(guest); |
104 } else { | 104 } else { |
105 guest_web_contents = static_cast<WebContentsImpl*>(guest->web_contents()); | 105 guest_web_contents = |
| 106 static_cast<WebContentsImpl*>(guest->GetWebContents()); |
106 } | 107 } |
107 | 108 |
108 // We ignore loading empty urls in web_contents. | 109 // We ignore loading empty urls in web_contents. |
109 // If a guest sets empty src attribute after it has navigated to some | 110 // If a guest sets empty src attribute after it has navigated to some |
110 // non-empty page, the action is considered no-op. | 111 // non-empty page, the action is considered no-op. |
111 // TODO(lazyboy): The js shim for browser-plugin might need to reflect empty | 112 // TODO(lazyboy): The js shim for browser-plugin might need to reflect empty |
112 // src ignoring in the shadow DOM element: http://crbug.com/149001. | 113 // src ignoring in the shadow DOM element: http://crbug.com/149001. |
113 if (!src.empty()) { | 114 if (!src.empty()) { |
114 guest_web_contents->GetController().LoadURL(url, | 115 guest_web_contents->GetController().LoadURL(url, |
115 Referrer(), | 116 Referrer(), |
(...skipping 19 matching lines...) Expand all Loading... |
135 int damage_buffer_size, | 136 int damage_buffer_size, |
136 #endif | 137 #endif |
137 int width, | 138 int width, |
138 int height, | 139 int height, |
139 bool resize_pending, | 140 bool resize_pending, |
140 float scale_factor) { | 141 float scale_factor) { |
141 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 142 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
142 if (!guest) | 143 if (!guest) |
143 return; | 144 return; |
144 WebContentsImpl* guest_web_contents = | 145 WebContentsImpl* guest_web_contents = |
145 static_cast<WebContentsImpl*>(guest->web_contents()); | 146 static_cast<WebContentsImpl*>(guest->GetWebContents()); |
146 guest->SetDamageBuffer(damage_buffer, | 147 guest->SetDamageBuffer(damage_buffer, |
147 #if defined(OS_WIN) | 148 #if defined(OS_WIN) |
148 damage_buffer_size, | 149 damage_buffer_size, |
149 #endif | 150 #endif |
150 gfx::Size(width, height), | 151 gfx::Size(width, height), |
151 scale_factor); | 152 scale_factor); |
152 if (!resize_pending) | 153 if (!resize_pending) |
153 guest_web_contents->GetView()->SizeContents(gfx::Size(width, height)); | 154 guest_web_contents->GetView()->SizeContents(gfx::Size(width, height)); |
154 } | 155 } |
155 | 156 |
(...skipping 17 matching lines...) Expand all Loading... |
173 const WebKit::WebInputEvent& event, | 174 const WebKit::WebInputEvent& event, |
174 IPC::Message* reply_message) { | 175 IPC::Message* reply_message) { |
175 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 176 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
176 if (guest) | 177 if (guest) |
177 guest->HandleInputEvent(render_view_host, guest_rect, event, reply_message); | 178 guest->HandleInputEvent(render_view_host, guest_rect, event, reply_message); |
178 } | 179 } |
179 | 180 |
180 void BrowserPluginEmbedder::DestroyGuestByInstanceID(int instance_id) { | 181 void BrowserPluginEmbedder::DestroyGuestByInstanceID(int instance_id) { |
181 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 182 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
182 if (guest) { | 183 if (guest) { |
183 WebContents* guest_web_contents = guest->web_contents(); | 184 WebContents* guest_web_contents = guest->GetWebContents(); |
184 | 185 |
185 // Destroy the guest's web_contents. | 186 // Destroy the guest's web_contents. |
186 delete guest_web_contents; | 187 delete guest_web_contents; |
187 guest_web_contents_by_instance_id_.erase(instance_id); | 188 guest_web_contents_by_instance_id_.erase(instance_id); |
188 } | 189 } |
189 } | 190 } |
190 | 191 |
191 void BrowserPluginEmbedder::RenderViewDeleted( | 192 void BrowserPluginEmbedder::RenderViewDeleted( |
192 RenderViewHost* render_view_host) { | 193 RenderViewHost* render_view_host) { |
193 DestroyGuests(); | 194 DestroyGuests(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool visible = *Details<bool>(details).ptr(); | 235 bool visible = *Details<bool>(details).ptr(); |
235 WebContentsVisibilityChanged(visible); | 236 WebContentsVisibilityChanged(visible); |
236 break; | 237 break; |
237 } | 238 } |
238 default: | 239 default: |
239 NOTREACHED() << "Unexpected notification type: " << type; | 240 NOTREACHED() << "Unexpected notification type: " << type; |
240 } | 241 } |
241 } | 242 } |
242 | 243 |
243 } // namespace content | 244 } // namespace content |
OLD | NEW |