Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: webkit/glue/plugins/webplugin_delegate_impl.cc

Issue 7871: This fixes http://code.google.com/p/chromium/issues/detail?id=3585, which is ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.h ('k') | webkit/glue/webplugin_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 plugin_wnd_proc_(NULL), 130 plugin_wnd_proc_(NULL),
131 last_message_(0), 131 last_message_(0),
132 is_calling_wndproc(false), 132 is_calling_wndproc(false),
133 initial_plugin_resize_done_(false), 133 initial_plugin_resize_done_(false),
134 dummy_window_for_activation_(NULL), 134 dummy_window_for_activation_(NULL),
135 handle_event_message_filter_hook_(NULL), 135 handle_event_message_filter_hook_(NULL),
136 handle_event_pump_messages_event_(NULL), 136 handle_event_pump_messages_event_(NULL),
137 handle_event_depth_(0), 137 handle_event_depth_(0),
138 user_gesture_message_posted_(false), 138 user_gesture_message_posted_(false),
139 #pragma warning(suppress: 4355) // can use this 139 #pragma warning(suppress: 4355) // can use this
140 user_gesture_msg_factory_(this), 140 user_gesture_msg_factory_(this) {
141 load_manually_(false),
142 first_geometry_update_(true) {
143 memset(&window_, 0, sizeof(window_)); 141 memset(&window_, 0, sizeof(window_));
144 142
145 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); 143 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info();
146 std::wstring filename = file_util::GetFilenameFromPath(plugin_info.file); 144 std::wstring filename = file_util::GetFilenameFromPath(plugin_info.file);
147 145
148 if (instance_->mime_type() == "application/x-shockwave-flash" || 146 if (instance_->mime_type() == "application/x-shockwave-flash" ||
149 filename == L"npswf32.dll") { 147 filename == L"npswf32.dll") {
150 // Flash only requests windowless plugins if we return a Mozilla user 148 // Flash only requests windowless plugins if we return a Mozilla user
151 // agent. 149 // agent.
152 instance_->set_use_mozilla_user_agent(); 150 instance_->set_use_mozilla_user_agent();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 instance_->set_window_handle(parent_); 234 instance_->set_window_handle(parent_);
237 CreateDummyWindowForActivation(); 235 CreateDummyWindowForActivation();
238 handle_event_pump_messages_event_ = CreateEvent(NULL, TRUE, FALSE, NULL); 236 handle_event_pump_messages_event_ = CreateEvent(NULL, TRUE, FALSE, NULL);
239 } else { 237 } else {
240 if (!WindowedCreatePlugin()) 238 if (!WindowedCreatePlugin())
241 return false; 239 return false;
242 } 240 }
243 241
244 plugin->SetWindow(windowed_handle_, handle_event_pump_messages_event_); 242 plugin->SetWindow(windowed_handle_, handle_event_pump_messages_event_);
245 243
246 load_manually_ = load_manually;
247 plugin_url_ = url.spec(); 244 plugin_url_ = url.spec();
248 return true; 245 return true;
249 } 246 }
250 247
251 void WebPluginDelegateImpl::DestroyInstance() { 248 void WebPluginDelegateImpl::DestroyInstance() {
252 if (instance_ && (instance_->npp()->ndata != NULL)) { 249 if (instance_ && (instance_->npp()->ndata != NULL)) {
253 // Shutdown all streams before destroying so that 250 // Shutdown all streams before destroying so that
254 // no streams are left "in progress". Need to do 251 // no streams are left "in progress". Need to do
255 // this before calling set_web_plugin(NULL) because the 252 // this before calling set_web_plugin(NULL) because the
256 // instance uses the helper to do the download. 253 // instance uses the helper to do the download.
(...skipping 15 matching lines...) Expand all
272 void WebPluginDelegateImpl::UpdateGeometry( 269 void WebPluginDelegateImpl::UpdateGeometry(
273 const gfx::Rect& window_rect, 270 const gfx::Rect& window_rect,
274 const gfx::Rect& clip_rect, 271 const gfx::Rect& clip_rect,
275 const std::vector<gfx::Rect>& cutout_rects, 272 const std::vector<gfx::Rect>& cutout_rects,
276 bool visible) { 273 bool visible) {
277 if (windowless_) { 274 if (windowless_) {
278 WindowlessUpdateGeometry(window_rect, clip_rect); 275 WindowlessUpdateGeometry(window_rect, clip_rect);
279 } else { 276 } else {
280 WindowedUpdateGeometry(window_rect, clip_rect, cutout_rects, visible); 277 WindowedUpdateGeometry(window_rect, clip_rect, cutout_rects, visible);
281 } 278 }
282
283 // Initiate a download on the plugin url. This should be done for the
284 // first update geometry sequence.
285 if (first_geometry_update_) {
286 first_geometry_update_ = false;
287 // An empty url corresponds to an EMBED tag with no src attribute.
288 if (!load_manually_ && !plugin_url_.empty()) {
289 instance_->SendStream(plugin_url_.c_str(), false, NULL);
290 }
291 }
292 } 279 }
293 280
294 void WebPluginDelegateImpl::Paint(HDC hdc, const gfx::Rect& rect) { 281 void WebPluginDelegateImpl::Paint(HDC hdc, const gfx::Rect& rect) {
295 if (windowless_) 282 if (windowless_)
296 WindowlessPaint(hdc, rect); 283 WindowlessPaint(hdc, rect);
297 } 284 }
298 285
299 void WebPluginDelegateImpl::Print(HDC hdc) { 286 void WebPluginDelegateImpl::Print(HDC hdc) {
300 // Disabling the call to NPP_Print as it causes a crash in 287 // Disabling the call to NPP_Print as it causes a crash in
301 // flash in some cases. In any case this does not work as expected 288 // flash in some cases. In any case this does not work as expected
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 break; 1099 break;
1113 } 1100 }
1114 1101
1115 return false; 1102 return false;
1116 } 1103 }
1117 1104
1118 void WebPluginDelegateImpl::OnUserGestureEnd() { 1105 void WebPluginDelegateImpl::OnUserGestureEnd() {
1119 user_gesture_message_posted_ = false; 1106 user_gesture_message_posted_ = false;
1120 instance()->PopPopupsEnabledState(); 1107 instance()->PopPopupsEnabledState();
1121 } 1108 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.h ('k') | webkit/glue/webplugin_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698