| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
| 10 #endif | 10 #endif |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 WebPluginProxy::~WebPluginProxy() { | 50 WebPluginProxy::~WebPluginProxy() { |
| 51 if (cp_browsing_context_) | 51 if (cp_browsing_context_) |
| 52 GetContextMap().erase(cp_browsing_context_); | 52 GetContextMap().erase(cp_browsing_context_); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool WebPluginProxy::Send(IPC::Message* msg) { | 55 bool WebPluginProxy::Send(IPC::Message* msg) { |
| 56 return channel_->Send(msg); | 56 return channel_->Send(msg); |
| 57 } | 57 } |
| 58 | 58 |
| 59 #if defined(OS_LINUX) |
| 60 gfx::PluginWindowHandle WebPluginProxy::CreatePluginContainer() { |
| 61 gfx::PluginWindowHandle container; |
| 62 Send(new PluginHostMsg_CreatePluginContainer(route_id_, &container)); |
| 63 return container; |
| 64 } |
| 65 #endif |
| 66 |
| 59 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { | 67 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { |
| 60 #if defined(OS_WIN) | 68 Send(new PluginHostMsg_SetWindow(route_id_, window)); |
| 61 Send(new PluginHostMsg_SetWindow(route_id_, gfx::IdFromNativeView(window))); | |
| 62 #else | |
| 63 NOTIMPLEMENTED(); | |
| 64 #endif | |
| 65 } | 69 } |
| 66 | 70 |
| 67 void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) { | 71 void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) { |
| 68 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 69 PluginThread::current()->Send( | 73 PluginThread::current()->Send( |
| 70 new PluginProcessHostMsg_PluginWindowDestroyed( | 74 new PluginProcessHostMsg_PluginWindowDestroyed( |
| 71 window, ::GetParent(window))); | 75 window, ::GetParent(window))); |
| 76 #elif defined(OS_LINUX) |
| 77 Send(new PluginHostMsg_DestroyPluginContainer(route_id_, window)); |
| 72 #else | 78 #else |
| 73 NOTIMPLEMENTED(); | 79 NOTIMPLEMENTED(); |
| 74 #endif | 80 #endif |
| 75 } | 81 } |
| 76 | 82 |
| 77 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 78 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { | 84 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { |
| 79 HANDLE pump_messages_event_for_renderer = NULL; | 85 HANDLE pump_messages_event_for_renderer = NULL; |
| 80 DuplicateHandle(GetCurrentProcess(), pump_messages_event, | 86 DuplicateHandle(GetCurrentProcess(), pump_messages_event, |
| 81 channel_->renderer_handle(), | 87 channel_->renderer_handle(), |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 intptr_t notify_data, | 274 intptr_t notify_data, |
| 269 bool popups_allowed) { | 275 bool popups_allowed) { |
| 270 if (!url) { | 276 if (!url) { |
| 271 NOTREACHED(); | 277 NOTREACHED(); |
| 272 return; | 278 return; |
| 273 } | 279 } |
| 274 | 280 |
| 275 if (!target && (0 == base::strcasecmp(method, "GET"))) { | 281 if (!target && (0 == base::strcasecmp(method, "GET"))) { |
| 276 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 | 282 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 |
| 277 // for more details on this. | 283 // for more details on this. |
| 278 #if defined(OS_WIN) | |
| 279 if (delegate_->GetQuirks() & | 284 if (delegate_->GetQuirks() & |
| 280 WebPluginDelegate::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { | 285 WebPluginDelegate::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { |
| 281 GURL request_url(url); | 286 GURL request_url(url); |
| 282 if (!request_url.SchemeIs(chrome::kHttpScheme) && | 287 if (!request_url.SchemeIs(chrome::kHttpScheme) && |
| 283 !request_url.SchemeIs(chrome::kHttpsScheme) && | 288 !request_url.SchemeIs(chrome::kHttpsScheme) && |
| 284 !request_url.SchemeIs(chrome::kFtpScheme)) { | 289 !request_url.SchemeIs(chrome::kFtpScheme)) { |
| 285 return; | 290 return; |
| 286 } | 291 } |
| 287 } | 292 } |
| 288 #else | |
| 289 // TODO(port): we need a GetQuirks() on our delegate impl. | |
| 290 NOTIMPLEMENTED(); | |
| 291 #endif | |
| 292 } | 293 } |
| 293 | 294 |
| 294 PluginHostMsg_URLRequest_Params params; | 295 PluginHostMsg_URLRequest_Params params; |
| 295 params.method = method; | 296 params.method = method; |
| 296 params.is_javascript_url = is_javascript_url; | 297 params.is_javascript_url = is_javascript_url; |
| 297 if (target) | 298 if (target) |
| 298 params.target = std::string(target); | 299 params.target = std::string(target); |
| 299 | 300 |
| 300 if (len) { | 301 if (len) { |
| 301 params.buffer.resize(len); | 302 params.buffer.resize(len); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // TODO(port): windowless painting. | 396 // TODO(port): windowless painting. |
| 396 NOTIMPLEMENTED(); | 397 NOTIMPLEMENTED(); |
| 397 #endif | 398 #endif |
| 398 } | 399 } |
| 399 | 400 |
| 400 void WebPluginProxy::UpdateGeometry( | 401 void WebPluginProxy::UpdateGeometry( |
| 401 const gfx::Rect& window_rect, | 402 const gfx::Rect& window_rect, |
| 402 const gfx::Rect& clip_rect, | 403 const gfx::Rect& clip_rect, |
| 403 const TransportDIB::Id& windowless_buffer_id, | 404 const TransportDIB::Id& windowless_buffer_id, |
| 404 const TransportDIB::Id& background_buffer_id) { | 405 const TransportDIB::Id& background_buffer_id) { |
| 405 #if defined(OS_WIN) | |
| 406 // TODO(port): this isn't correct usage of a TransportDIB; for now, | 406 // TODO(port): this isn't correct usage of a TransportDIB; for now, |
| 407 // the caller temporarly just stuffs the handle into the HANDLE | 407 // the caller temporarly just stuffs the handle into the HANDLE |
| 408 // field of the TransportDIB::Id so it should behave like the older | 408 // field of the TransportDIB::Id so it should behave like the older |
| 409 // code. | 409 // code. |
| 410 gfx::Rect old = delegate_->GetRect(); | 410 gfx::Rect old = delegate_->GetRect(); |
| 411 gfx::Rect old_clip_rect = delegate_->GetClipRect(); | 411 gfx::Rect old_clip_rect = delegate_->GetClipRect(); |
| 412 | 412 |
| 413 delegate_->UpdateGeometry(window_rect, clip_rect); |
| 414 #if defined(OS_WIN) |
| 413 bool moved = old.x() != window_rect.x() || old.y() != window_rect.y(); | 415 bool moved = old.x() != window_rect.x() || old.y() != window_rect.y(); |
| 414 delegate_->UpdateGeometry(window_rect, clip_rect); | |
| 415 if (windowless_buffer_id.handle) { | 416 if (windowless_buffer_id.handle) { |
| 416 // The plugin's rect changed, so now we have a new buffer to draw into. | 417 // The plugin's rect changed, so now we have a new buffer to draw into. |
| 417 SetWindowlessBuffer(windowless_buffer_id.handle, | 418 SetWindowlessBuffer(windowless_buffer_id.handle, |
| 418 background_buffer_id.handle); | 419 background_buffer_id.handle); |
| 419 } else if (moved) { | 420 } else if (moved) { |
| 420 // The plugin moved, so update our world transform. | 421 // The plugin moved, so update our world transform. |
| 421 UpdateTransform(); | 422 UpdateTransform(); |
| 422 } | 423 } |
| 423 // Send over any pending invalidates which occured when the plugin was | 424 // Send over any pending invalidates which occured when the plugin was |
| 424 // off screen. | 425 // off screen. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 while (index != resource_clients_.end()) { | 532 while (index != resource_clients_.end()) { |
| 532 WebPluginResourceClient* client = (*index).second; | 533 WebPluginResourceClient* client = (*index).second; |
| 533 | 534 |
| 534 if (client == resource_client) { | 535 if (client == resource_client) { |
| 535 resource_clients_.erase(index++); | 536 resource_clients_.erase(index++); |
| 536 } else { | 537 } else { |
| 537 index++; | 538 index++; |
| 538 } | 539 } |
| 539 } | 540 } |
| 540 } | 541 } |
| OLD | NEW |