| 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 damage_buffer_size_(0), | 268 damage_buffer_size_(0), |
| 269 damage_buffer_scale_factor_(1.0f), | 269 damage_buffer_scale_factor_(1.0f), |
| 270 guest_device_scale_factor_(1.0f), | 270 guest_device_scale_factor_(1.0f), |
| 271 guest_hang_timeout_( | 271 guest_hang_timeout_( |
| 272 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), | 272 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), |
| 273 focused_(false), | 273 focused_(false), |
| 274 mouse_locked_(false), | 274 mouse_locked_(false), |
| 275 pending_lock_request_(false), | 275 pending_lock_request_(false), |
| 276 embedder_visible_(true), | 276 embedder_visible_(true), |
| 277 next_permission_request_id_(0), | 277 next_permission_request_id_(0), |
| 278 has_render_view_(has_render_view) { | 278 has_render_view_(has_render_view), |
| 279 is_being_destroyed_(false) { |
| 279 DCHECK(web_contents); | 280 DCHECK(web_contents); |
| 280 web_contents->SetDelegate(this); | 281 web_contents->SetDelegate(this); |
| 281 if (opener) | 282 if (opener) |
| 282 opener_ = opener->AsWeakPtr(); | 283 opener_ = opener->AsWeakPtr(); |
| 283 GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_, | 284 GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_, |
| 284 GetWebContents()); | 285 GetWebContents()); |
| 285 } | 286 } |
| 286 | 287 |
| 287 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source, | 288 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source, |
| 288 int32 level, | 289 int32 level, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 313 for (PendingWindowMap::const_iterator it = pending_new_windows.begin(); | 314 for (PendingWindowMap::const_iterator it = pending_new_windows.begin(); |
| 314 it != pending_new_windows.end(); ++it) { | 315 it != pending_new_windows.end(); ++it) { |
| 315 it->first->Destroy(); | 316 it->first->Destroy(); |
| 316 } | 317 } |
| 317 // All pending windows should be removed from the set after Destroy() is | 318 // All pending windows should be removed from the set after Destroy() is |
| 318 // called on all of them. | 319 // called on all of them. |
| 319 DCHECK_EQ(0ul, pending_new_windows_.size()); | 320 DCHECK_EQ(0ul, pending_new_windows_.size()); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void BrowserPluginGuest::Destroy() { | 323 void BrowserPluginGuest::Destroy() { |
| 324 if (is_being_destroyed_) |
| 325 return; |
| 326 is_being_destroyed_ = true; |
| 323 if (!attached() && opener()) | 327 if (!attached() && opener()) |
| 324 opener()->pending_new_windows_.erase(this); | 328 opener()->pending_new_windows_.erase(this); |
| 325 DestroyUnattachedWindows(); | 329 DestroyUnattachedWindows(); |
| 326 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); | 330 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); |
| 327 delete GetWebContents(); | 331 delete GetWebContents(); |
| 328 } | 332 } |
| 329 | 333 |
| 330 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( | 334 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( |
| 331 const IPC::Message& message) { | 335 const IPC::Message& message) { |
| 332 bool handled = true; | 336 bool handled = true; |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 base::Value::CreateStringValue(request_method)); | 1551 base::Value::CreateStringValue(request_method)); |
| 1548 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1552 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
| 1549 | 1553 |
| 1550 SendMessageToEmbedder( | 1554 SendMessageToEmbedder( |
| 1551 new BrowserPluginMsg_RequestPermission(instance_id(), | 1555 new BrowserPluginMsg_RequestPermission(instance_id(), |
| 1552 BrowserPluginPermissionTypeDownload, permission_request_id, | 1556 BrowserPluginPermissionTypeDownload, permission_request_id, |
| 1553 request_info)); | 1557 request_info)); |
| 1554 } | 1558 } |
| 1555 | 1559 |
| 1556 } // namespace content | 1560 } // namespace content |
| OLD | NEW |