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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 869563003: [Mac] Allow vibrancy & transparency on WebContentsView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 10
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 1701
1702 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r { 1702 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r {
1703 self = [super initWithFrame:NSZeroRect]; 1703 self = [super initWithFrame:NSZeroRect];
1704 if (self) { 1704 if (self) {
1705 self.acceptsTouchEvents = YES; 1705 self.acceptsTouchEvents = YES;
1706 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper); 1706 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper);
1707 editCommand_helper_->AddEditingSelectorsToClass([self class]); 1707 editCommand_helper_->AddEditingSelectorsToClass([self class]);
1708 1708
1709 renderWidgetHostView_.reset(r); 1709 renderWidgetHostView_.reset(r);
1710 canBeKeyView_ = YES; 1710 canBeKeyView_ = YES;
1711 opaque_ = YES;
1711 focusedPluginIdentifier_ = -1; 1712 focusedPluginIdentifier_ = -1;
1712 1713
1713 // OpenGL support: 1714 // OpenGL support:
1714 if ([self respondsToSelector: 1715 if ([self respondsToSelector:
1715 @selector(setWantsBestResolutionOpenGLSurface:)]) { 1716 @selector(setWantsBestResolutionOpenGLSurface:)]) {
1716 [self setWantsBestResolutionOpenGLSurface:YES]; 1717 [self setWantsBestResolutionOpenGLSurface:YES];
1717 } 1718 }
1718 [[NSNotificationCenter defaultCenter] 1719 [[NSNotificationCenter defaultCenter]
1719 addObserver:self 1720 addObserver:self
1720 selector:@selector(didChangeScreenParameters:) 1721 selector:@selector(didChangeScreenParameters:)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 } 1790 }
1790 1791
1791 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { 1792 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
1792 return [self acceptsMouseEventsWhenInactive]; 1793 return [self acceptsMouseEventsWhenInactive];
1793 } 1794 }
1794 1795
1795 - (void)setCloseOnDeactivate:(BOOL)b { 1796 - (void)setCloseOnDeactivate:(BOOL)b {
1796 closeOnDeactivate_ = b; 1797 closeOnDeactivate_ = b;
1797 } 1798 }
1798 1799
1800 - (void)setOpaque:(BOOL)opaque {
1801 opaque_ = opaque;
1802 }
1803
1799 - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { 1804 - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent {
1800 NSWindow* window = [self window]; 1805 NSWindow* window = [self window];
1801 // If this is a background window, don't handle mouse movement events. This 1806 // If this is a background window, don't handle mouse movement events. This
1802 // is the expected behavior on the Mac as evidenced by other applications. 1807 // is the expected behavior on the Mac as evidenced by other applications.
1803 if ([theEvent type] == NSMouseMoved && 1808 if ([theEvent type] == NSMouseMoved &&
1804 ![self acceptsMouseEventsWhenInactive] && 1809 ![self acceptsMouseEventsWhenInactive] &&
1805 ![window isKeyWindow]) { 1810 ![window isKeyWindow]) {
1806 return YES; 1811 return YES;
1807 } 1812 }
1808 1813
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3360 if (!string) return NO; 3365 if (!string) return NO;
3361 3366
3362 // If the user is currently using an IME, confirm the IME input, 3367 // If the user is currently using an IME, confirm the IME input,
3363 // and then insert the text from the service, the same as TextEdit and Safari. 3368 // and then insert the text from the service, the same as TextEdit and Safari.
3364 [self confirmComposition]; 3369 [self confirmComposition];
3365 [self insertText:string]; 3370 [self insertText:string];
3366 return YES; 3371 return YES;
3367 } 3372 }
3368 3373
3369 - (BOOL)isOpaque { 3374 - (BOOL)isOpaque {
3370 return YES; 3375 return opaque_;
3371 } 3376 }
3372 3377
3373 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3378 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3374 // regions that are not draggable. (See ControlRegionView in 3379 // regions that are not draggable. (See ControlRegionView in
3375 // native_app_window_cocoa.mm). This requires the render host view to be 3380 // native_app_window_cocoa.mm). This requires the render host view to be
3376 // draggable by default. 3381 // draggable by default.
3377 - (BOOL)mouseDownCanMoveWindow { 3382 - (BOOL)mouseDownCanMoveWindow {
3378 return YES; 3383 return YES;
3379 } 3384 }
3380 3385
3381 @end 3386 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698