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

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl_mac.mm

Issue 12406010: Npapi cleanup: USE_SKIA is always true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | 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) 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 "webkit/plugins/npapi/webplugin_delegate_impl.h" 5 #include "webkit/plugins/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 <unistd.h> 9 #include <unistd.h>
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 13
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/metrics/stats_counters.h" 16 #include "base/metrics/stats_counters.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/sys_string_conversions.h" 18 #include "base/sys_string_conversions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "skia/ext/skia_utils_mac.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
21 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
22 #include "webkit/plugins/npapi/plugin_instance.h" 23 #include "webkit/plugins/npapi/plugin_instance.h"
23 #include "webkit/plugins/npapi/plugin_lib.h" 24 #include "webkit/plugins/npapi/plugin_lib.h"
24 #include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" 25 #include "webkit/plugins/npapi/plugin_web_event_converter_mac.h"
25 #include "webkit/plugins/npapi/webplugin.h" 26 #include "webkit/plugins/npapi/webplugin.h"
26 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" 27 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h"
27 28
28 #if defined(USE_SKIA)
29 #include "skia/ext/skia_utils_mac.h"
30 #endif
31
32 using WebKit::WebCursorInfo; 29 using WebKit::WebCursorInfo;
33 using WebKit::WebKeyboardEvent; 30 using WebKit::WebKeyboardEvent;
34 using WebKit::WebInputEvent; 31 using WebKit::WebInputEvent;
35 using WebKit::WebMouseEvent; 32 using WebKit::WebMouseEvent;
36 using WebKit::WebMouseWheelEvent; 33 using WebKit::WebMouseWheelEvent;
37 34
38 // Important implementation notes: The Mac definition of NPAPI, particularly 35 // Important implementation notes: The Mac definition of NPAPI, particularly
39 // the distinction between windowed and windowless modes, differs from the 36 // the distinction between windowed and windowless modes, differs from the
40 // Windows and Linux definitions. Most of those differences are 37 // Windows and Linux definitions. Most of those differences are
41 // accomodated by the WebPluginDelegate class. 38 // accomodated by the WebPluginDelegate class.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 276
280 void WebPluginDelegateImpl::UpdateGeometryAndContext( 277 void WebPluginDelegateImpl::UpdateGeometryAndContext(
281 const gfx::Rect& window_rect, const gfx::Rect& clip_rect, 278 const gfx::Rect& window_rect, const gfx::Rect& clip_rect,
282 CGContextRef context) { 279 CGContextRef context) {
283 buffer_context_ = context; 280 buffer_context_ = context;
284 UpdateGeometry(window_rect, clip_rect); 281 UpdateGeometry(window_rect, clip_rect);
285 } 282 }
286 283
287 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, 284 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas,
288 const gfx::Rect& rect) { 285 const gfx::Rect& rect) {
289 #if defined(USE_SKIA)
290 gfx::SkiaBitLocker bit_locker(canvas); 286 gfx::SkiaBitLocker bit_locker(canvas);
291 CGContextRef context = bit_locker.cgContext(); 287 CGContextRef context = bit_locker.cgContext();
292 #else
293 CGContextRef context = canvas;
294 #endif
295 CGPaint(context, rect); 288 CGPaint(context, rect);
296 } 289 }
297 290
298 void WebPluginDelegateImpl::CGPaint(CGContextRef context, 291 void WebPluginDelegateImpl::CGPaint(CGContextRef context,
299 const gfx::Rect& rect) { 292 const gfx::Rect& rect) {
300 WindowlessPaint(context, rect); 293 WindowlessPaint(context, rect);
301 } 294 }
302 295
303 bool WebPluginDelegateImpl::PlatformHandleInputEvent( 296 bool WebPluginDelegateImpl::PlatformHandleInputEvent(
304 const WebInputEvent& event, WebCursorInfo* cursor_info) { 297 const WebInputEvent& event, WebCursorInfo* cursor_info) {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 DCHECK(!composited_); 744 DCHECK(!composited_);
752 windowed_handle_ = handle; 745 windowed_handle_ = handle;
753 surface_->SetWindowHandle(handle); 746 surface_->SetWindowHandle(handle);
754 UpdateAcceleratedSurface(); 747 UpdateAcceleratedSurface();
755 // Kick off the drawing timer, if necessary. 748 // Kick off the drawing timer, if necessary.
756 PluginVisibilityChanged(); 749 PluginVisibilityChanged();
757 } 750 }
758 751
759 } // namespace npapi 752 } // namespace npapi
760 } // namespace webkit 753 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698