OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
10 #import "base/chrome_application_mac.h" | 10 #import "base/chrome_application_mac.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 } // namespace | 131 } // namespace |
132 | 132 |
133 // AcceleratedPluginView ------------------------------------------------------ | 133 // AcceleratedPluginView ------------------------------------------------------ |
134 | 134 |
135 // This subclass of NSView hosts the output of accelerated plugins on | 135 // This subclass of NSView hosts the output of accelerated plugins on |
136 // the page. | 136 // the page. |
137 | 137 |
138 // Informal protocol implemented by windows that need to be informed explicitly | 138 // Informal protocol implemented by windows that need to be informed explicitly |
139 // about underlay surfaces. | 139 // about underlay surfaces. |
140 @protocol UnderlayableSurface | 140 @interface RenderWidgetHostViewCocoa (UnderlayableSurface) |
141 - (void)underlaySurfaceAdded; | 141 - (void)underlaySurfaceAdded; |
142 - (void)underlaySurfaceRemoved; | 142 - (void)underlaySurfaceRemoved; |
143 @end | 143 @end |
144 | 144 |
145 @interface AcceleratedPluginView : NSView { | 145 @interface AcceleratedPluginView : NSView { |
146 scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat_; | 146 scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat_; |
147 CGLPixelFormatObj cglPixelFormat_; // weak, backed by |glPixelFormat_|. | 147 CGLPixelFormatObj cglPixelFormat_; // weak, backed by |glPixelFormat_|. |
148 scoped_nsobject<NSOpenGLContext> glContext_; | 148 scoped_nsobject<NSOpenGLContext> glContext_; |
149 CGLContextObj cglContext_; // weak, backed by |glContext_|. | 149 CGLContextObj cglContext_; // weak, backed by |glContext_|. |
150 | 150 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 312 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
313 [super dealloc]; | 313 [super dealloc]; |
314 } | 314 } |
315 | 315 |
316 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { | 316 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
317 if (CommandLine::ForCurrentProcess()->HasSwitch( | 317 if (CommandLine::ForCurrentProcess()->HasSwitch( |
318 switches::kDisableHolePunching)) { | 318 switches::kDisableHolePunching)) { |
319 return; | 319 return; |
320 } | 320 } |
321 | 321 |
322 if ([self window] && | 322 if ([[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { |
323 [[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { | |
324 [static_cast<id>([self window]) underlaySurfaceRemoved]; | 323 [static_cast<id>([self window]) underlaySurfaceRemoved]; |
325 } | 324 } |
326 | 325 |
327 if (newWindow && | 326 if ([newWindow respondsToSelector:@selector(underlaySurfaceAdded)]) { |
328 [newWindow respondsToSelector:@selector(underlaySurfaceAdded)]) { | |
329 [static_cast<id>(newWindow) underlaySurfaceAdded]; | 327 [static_cast<id>(newWindow) underlaySurfaceAdded]; |
330 } | 328 } |
331 } | 329 } |
332 @end | 330 @end |
333 | 331 |
334 // RenderWidgetHostView -------------------------------------------------------- | 332 // RenderWidgetHostView -------------------------------------------------------- |
335 | 333 |
336 // static | 334 // static |
337 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 335 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
338 RenderWidgetHost* widget) { | 336 RenderWidgetHost* widget) { |
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 if (!string) return NO; | 2378 if (!string) return NO; |
2381 | 2379 |
2382 // If the user is currently using an IME, confirm the IME input, | 2380 // If the user is currently using an IME, confirm the IME input, |
2383 // and then insert the text from the service, the same as TextEdit and Safari. | 2381 // and then insert the text from the service, the same as TextEdit and Safari. |
2384 [self confirmComposition]; | 2382 [self confirmComposition]; |
2385 [self insertText:string]; | 2383 [self insertText:string]; |
2386 return YES; | 2384 return YES; |
2387 } | 2385 } |
2388 | 2386 |
2389 @end | 2387 @end |
OLD | NEW |