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

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

Issue 12896006: mac: Clean up a few more uses of USE_SKIA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 270
274 void WebPluginDelegateImpl::UpdateGeometryAndContext( 271 void WebPluginDelegateImpl::UpdateGeometryAndContext(
275 const gfx::Rect& window_rect, const gfx::Rect& clip_rect, 272 const gfx::Rect& window_rect, const gfx::Rect& clip_rect,
276 CGContextRef context) { 273 CGContextRef context) {
277 buffer_context_ = context; 274 buffer_context_ = context;
278 UpdateGeometry(window_rect, clip_rect); 275 UpdateGeometry(window_rect, clip_rect);
279 } 276 }
280 277
281 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, 278 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas,
282 const gfx::Rect& rect) { 279 const gfx::Rect& rect) {
283 #if defined(USE_SKIA)
284 gfx::SkiaBitLocker bit_locker(canvas); 280 gfx::SkiaBitLocker bit_locker(canvas);
285 CGContextRef context = bit_locker.cgContext(); 281 CGContextRef context = bit_locker.cgContext();
286 #else
287 CGContextRef context = canvas;
288 #endif
289 CGPaint(context, rect); 282 CGPaint(context, rect);
290 } 283 }
291 284
292 void WebPluginDelegateImpl::CGPaint(CGContextRef context, 285 void WebPluginDelegateImpl::CGPaint(CGContextRef context,
293 const gfx::Rect& rect) { 286 const gfx::Rect& rect) {
294 WindowlessPaint(context, rect); 287 WindowlessPaint(context, rect);
295 } 288 }
296 289
297 bool WebPluginDelegateImpl::PlatformHandleInputEvent( 290 bool WebPluginDelegateImpl::PlatformHandleInputEvent(
298 const WebInputEvent& event, WebCursorInfo* cursor_info) { 291 const WebInputEvent& event, WebCursorInfo* cursor_info) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 [CATransaction commit]; 719 [CATransaction commit];
727 720
728 [renderer_ setBounds:[layer_ bounds]]; 721 [renderer_ setBounds:[layer_ bounds]];
729 surface_->SetSize(window_rect_.size()); 722 surface_->SetSize(window_rect_.size());
730 // Kick off the drawing timer, if necessary. 723 // Kick off the drawing timer, if necessary.
731 PluginVisibilityChanged(); 724 PluginVisibilityChanged();
732 } 725 }
733 726
734 } // namespace npapi 727 } // namespace npapi
735 } // namespace webkit 728 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698