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_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" |
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { | 84 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { |
85 SendMessageToEmbedder( | 85 SendMessageToEmbedder( |
86 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); | 86 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); |
87 } | 87 } |
88 | 88 |
89 WebContents* BrowserPluginGuest::GetWebContents() { | 89 WebContents* BrowserPluginGuest::GetWebContents() { |
90 return web_contents(); | 90 return web_contents(); |
91 } | 91 } |
92 | 92 |
| 93 void BrowserPluginGuest::Terminate() { |
| 94 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Terminate")); |
| 95 base::ProcessHandle process_handle = |
| 96 web_contents()->GetRenderProcessHost()->GetHandle(); |
| 97 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); |
| 98 } |
| 99 |
93 void BrowserPluginGuest::SetDamageBuffer( | 100 void BrowserPluginGuest::SetDamageBuffer( |
94 TransportDIB* damage_buffer, | 101 TransportDIB* damage_buffer, |
95 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
96 int damage_buffer_size, | 103 int damage_buffer_size, |
97 #endif | 104 #endif |
98 const gfx::Size& damage_view_size, | 105 const gfx::Size& damage_view_size, |
99 float scale_factor) { | 106 float scale_factor) { |
100 // Sanity check: Verify that we've correctly shared the damage buffer memory | 107 // Sanity check: Verify that we've correctly shared the damage buffer memory |
101 // between the embedder and browser processes. | 108 // between the embedder and browser processes. |
102 DCHECK(*static_cast<unsigned int*>(damage_buffer->memory()) == 0xdeadbeef); | 109 DCHECK(*static_cast<unsigned int*>(damage_buffer->memory()) == 0xdeadbeef); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 break; | 324 break; |
318 } | 325 } |
319 } | 326 } |
320 | 327 |
321 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 328 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
322 DCHECK(embedder_render_process_host()); | 329 DCHECK(embedder_render_process_host()); |
323 embedder_render_process_host()->Send(msg); | 330 embedder_render_process_host()->Send(msg); |
324 } | 331 } |
325 | 332 |
326 } // namespace content | 333 } // namespace content |
OLD | NEW |