| 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 "webkit/glue/plugins/webplugin_delegate_impl.h" | 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 NPError err = instance_->NPP_GetValue(NPPVpluginNeedsXEmbed, &xembed); | 259 NPError err = instance_->NPP_GetValue(NPPVpluginNeedsXEmbed, &xembed); |
| 260 DCHECK(err == NPERR_NO_ERROR); | 260 DCHECK(err == NPERR_NO_ERROR); |
| 261 if (!xembed) { | 261 if (!xembed) { |
| 262 NOTIMPLEMENTED() << "Windowed plugin but without xembed."; | 262 NOTIMPLEMENTED() << "Windowed plugin but without xembed."; |
| 263 return false; | 263 return false; |
| 264 } | 264 } |
| 265 | 265 |
| 266 window_.window = reinterpret_cast<void*>(parent_); | 266 window_.window = reinterpret_cast<void*>(parent_); |
| 267 // The remainder of the code expects windowed_handle_ to exist for | 267 // The remainder of the code expects windowed_handle_ to exist for |
| 268 // windowed mode, despite not actually ever reaching through | 268 // windowed mode, despite not actually ever reaching through |
| 269 // windowed_handle_. So let's set it to the one window handle we | 269 // windowed_handle_. It is still used as a token to represent "this |
| 270 // actually have available. | 270 // plugin" in messages to the browser. |
| 271 windowed_handle_ = parent_; | 271 windowed_handle_ = parent_; |
| 272 | 272 |
| 273 if (!window_.ws_info) | 273 if (!window_.ws_info) |
| 274 window_.ws_info = new NPSetWindowCallbackStruct; | 274 window_.ws_info = new NPSetWindowCallbackStruct; |
| 275 NPSetWindowCallbackStruct* extra = | 275 NPSetWindowCallbackStruct* extra = |
| 276 static_cast<NPSetWindowCallbackStruct*>(window_.ws_info); | 276 static_cast<NPSetWindowCallbackStruct*>(window_.ws_info); |
| 277 extra->display = GDK_DISPLAY(); | 277 extra->display = GDK_DISPLAY(); |
| 278 extra->visual = DefaultVisual(GDK_DISPLAY(), 0); | 278 extra->visual = DefaultVisual(GDK_DISPLAY(), 0); |
| 279 extra->depth = DefaultDepth(GDK_DISPLAY(), 0); | 279 extra->depth = DefaultDepth(GDK_DISPLAY(), 0); |
| 280 extra->colormap = DefaultColormap(GDK_DISPLAY(), 0); | 280 extra->colormap = DefaultColormap(GDK_DISPLAY(), 0); |
| 281 | 281 |
| 282 return true; | 282 return true; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void WebPluginDelegateImpl::WindowedDestroyWindow() { | 285 void WebPluginDelegateImpl::WindowedDestroyWindow() { |
| 286 // We have no window to destroy; see comment in WindowedCreatePlugin | 286 if (windowed_handle_) { |
| 287 // where windowed_handle_ is set. | 287 plugin_->WillDestroyWindow(windowed_handle_); |
| 288 windowed_handle_ = 0; | 288 |
| 289 windowed_handle_ = 0; |
| 290 } |
| 289 } | 291 } |
| 290 | 292 |
| 291 bool WebPluginDelegateImpl::WindowedReposition( | 293 bool WebPluginDelegateImpl::WindowedReposition( |
| 292 const gfx::Rect& window_rect, | 294 const gfx::Rect& window_rect, |
| 293 const gfx::Rect& clip_rect) { | 295 const gfx::Rect& clip_rect) { |
| 294 if (window_rect == window_rect_ && clip_rect == clip_rect_) | 296 if (window_rect == window_rect_ && clip_rect == clip_rect_) |
| 295 return false; | 297 return false; |
| 296 | 298 |
| 297 window_rect_ = window_rect; | 299 window_rect_ = window_rect; |
| 298 clip_rect_ = clip_rect; | 300 clip_rect_ = clip_rect; |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 return stream; | 842 return stream; |
| 841 } | 843 } |
| 842 | 844 |
| 843 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, | 845 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, |
| 844 bool notify_needed, | 846 bool notify_needed, |
| 845 intptr_t notify_data) { | 847 intptr_t notify_data) { |
| 846 if (notify_needed) { | 848 if (notify_needed) { |
| 847 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); | 849 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); |
| 848 } | 850 } |
| 849 } | 851 } |
| OLD | NEW |