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

Side by Side Diff: content/child/npapi/webplugin_delegate_impl_mac.mm

Issue 1815593002: Remove windowed NPAPI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_test_plugin_windowless
Patch Set: rebase Created 4 years, 9 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
OLDNEW
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/child/npapi/webplugin_delegate_impl.h" 5 #include "content/child/npapi/webplugin_delegate_impl.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <QuartzCore/QuartzCore.h> 8 #import <QuartzCore/QuartzCore.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 WebInputEvent::RightButtonDown | 142 WebInputEvent::RightButtonDown |
143 WebInputEvent::MiddleButtonDown; 143 WebInputEvent::MiddleButtonDown;
144 } 144 }
145 145
146 #pragma mark - 146 #pragma mark -
147 #pragma mark Core WebPluginDelegate implementation 147 #pragma mark Core WebPluginDelegate implementation
148 148
149 WebPluginDelegateImpl::WebPluginDelegateImpl( 149 WebPluginDelegateImpl::WebPluginDelegateImpl(
150 WebPlugin* plugin, 150 WebPlugin* plugin,
151 PluginInstance* instance) 151 PluginInstance* instance)
152 : windowed_handle_(gfx::kNullPluginWindow), 152 : plugin_(plugin),
153 // all Mac plugins are "windowless" in the Windows/X11 sense
154 windowless_(true),
155 plugin_(plugin),
156 instance_(instance), 153 instance_(instance),
157 quirks_(0), 154 quirks_(0),
158 use_buffer_context_(true), 155 use_buffer_context_(true),
159 buffer_context_(NULL), 156 buffer_context_(NULL),
160 layer_(nil), 157 layer_(nil),
161 surface_(NULL), 158 surface_(NULL),
162 renderer_(nil), 159 renderer_(nil),
163 containing_window_has_focus_(false), 160 containing_window_has_focus_(false),
164 initial_window_focus_(false), 161 initial_window_focus_(false),
165 container_is_visible_(false), 162 container_is_visible_(false),
166 have_called_set_window_(false), 163 have_called_set_window_(false),
167 ime_enabled_(false), 164 ime_enabled_(false),
168 keyup_ignore_count_(0), 165 keyup_ignore_count_(0),
169 external_drag_tracker_(new ExternalDragTracker()), 166 external_drag_tracker_(new ExternalDragTracker()),
170 handle_event_depth_(0), 167 handle_event_depth_(0),
171 first_set_window_call_(true), 168 first_set_window_call_(true),
172 plugin_has_focus_(false), 169 plugin_has_focus_(false),
173 has_webkit_focus_(false), 170 has_webkit_focus_(false),
174 containing_view_has_focus_(true), 171 containing_view_has_focus_(true),
175 creation_succeeded_(false) { 172 creation_succeeded_(false) {
176 memset(&window_, 0, sizeof(window_)); 173 memset(&window_, 0, sizeof(window_));
177 instance->set_windowless(true);
178 } 174 }
179 175
180 WebPluginDelegateImpl::~WebPluginDelegateImpl() { 176 WebPluginDelegateImpl::~WebPluginDelegateImpl() {
181 DestroyInstance(); 177 DestroyInstance();
182 } 178 }
183 179
184 bool WebPluginDelegateImpl::PlatformInitialize() { 180 bool WebPluginDelegateImpl::PlatformInitialize() {
185 // Don't set a NULL window handle on destroy for Mac plugins. This matches 181 // Don't set a NULL window handle on destroy for Mac plugins. This matches
186 // Safari and other Mac browsers (see PluginView::stop() in PluginView.cpp, 182 // Safari and other Mac browsers (see PluginView::stop() in PluginView.cpp,
187 // where code to do so is surrounded by an #ifdef that excludes Mac OS X, or 183 // where code to do so is surrounded by an #ifdef that excludes Mac OS X, or
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 plugin_->AcceleratedPluginEnabledRendering(); 241 plugin_->AcceleratedPluginEnabledRendering();
246 } 242 }
247 } 243 }
248 break; 244 break;
249 } 245 }
250 default: 246 default:
251 NOTREACHED(); 247 NOTREACHED();
252 break; 248 break;
253 } 249 }
254 250
255 // Let the WebPlugin know that we are windowless, unless this is a Core
256 // Animation plugin, in which case AcceleratedPluginEnabledRendering
257 // calls SetWindow. Rendering breaks if SetWindow is called before
258 // accelerated rendering is enabled.
259 if (!layer_)
260 plugin_->SetWindow(gfx::kNullPluginWindow);
261
262 return true; 251 return true;
263 } 252 }
264 253
265 void WebPluginDelegateImpl::PlatformDestroyInstance() { 254 void WebPluginDelegateImpl::PlatformDestroyInstance() {
266 if (redraw_timer_) 255 if (redraw_timer_)
267 redraw_timer_->Stop(); 256 redraw_timer_->Stop();
268 [renderer_ release]; 257 [renderer_ release];
269 renderer_ = nil; 258 renderer_ = nil;
270 layer_ = nil; 259 layer_ = nil;
271 } 260 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 if (!have_called_set_window_) { 490 if (!have_called_set_window_) {
502 have_called_set_window_ = true; 491 have_called_set_window_ = true;
503 SetWindowHasFocus(initial_window_focus_); 492 SetWindowHasFocus(initial_window_focus_);
504 } 493 }
505 494
506 DCHECK(err == NPERR_NO_ERROR); 495 DCHECK(err == NPERR_NO_ERROR);
507 } 496 }
508 497
509 #pragma mark - 498 #pragma mark -
510 499
511 bool WebPluginDelegateImpl::WindowedCreatePlugin() {
512 NOTREACHED();
513 return false;
514 }
515
516 void WebPluginDelegateImpl::WindowedDestroyWindow() {
517 NOTREACHED();
518 }
519
520 bool WebPluginDelegateImpl::WindowedReposition(const gfx::Rect& window_rect,
521 const gfx::Rect& clip_rect) {
522 NOTREACHED();
523 return false;
524 }
525
526 void WebPluginDelegateImpl::WindowedSetWindow() {
527 NOTREACHED();
528 }
529
530 #pragma mark - 500 #pragma mark -
531 #pragma mark Mac Extensions 501 #pragma mark Mac Extensions
532 502
533 void WebPluginDelegateImpl::PluginDidInvalidate() { 503 void WebPluginDelegateImpl::PluginDidInvalidate() {
534 if (instance()->drawing_model() == NPDrawingModelInvalidatingCoreAnimation) 504 if (instance()->drawing_model() == NPDrawingModelInvalidatingCoreAnimation)
535 DrawLayerInSurface(); 505 DrawLayerInSurface();
536 } 506 }
537 507
538 WebPluginDelegateImpl* WebPluginDelegateImpl::GetActiveDelegate() { 508 WebPluginDelegateImpl* WebPluginDelegateImpl::GetActiveDelegate() {
539 return g_active_delegate; 509 return g_active_delegate;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 window_rect_.width(), window_rect_.height())]; 687 window_rect_.width(), window_rect_.height())];
718 [CATransaction commit]; 688 [CATransaction commit];
719 689
720 [renderer_ setBounds:[layer_ bounds]]; 690 [renderer_ setBounds:[layer_ bounds]];
721 surface_->SetSize(window_rect_.size()); 691 surface_->SetSize(window_rect_.size());
722 // Kick off the drawing timer, if necessary. 692 // Kick off the drawing timer, if necessary.
723 PluginVisibilityChanged(); 693 PluginVisibilityChanged();
724 } 694 }
725 695
726 } // namespace content 696 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/webplugin_delegate_impl_aura.cc ('k') | content/child/npapi/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698