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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 869563003: [Mac] Allow vibrancy & transparency on WebContentsView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to [WebContentsViewCocoa allowsVibrancy] 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
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.h ('k') | 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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #import "content/browser/web_contents/web_contents_view_mac.h" 7 #import "content/browser/web_contents/web_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 [self cancelDeferredClose]; 416 [self cancelDeferredClose];
417 417
418 // This probably isn't strictly necessary, but can't hurt. 418 // This probably isn't strictly necessary, but can't hurt.
419 [self unregisterDraggedTypes]; 419 [self unregisterDraggedTypes];
420 420
421 [[NSNotificationCenter defaultCenter] removeObserver:self]; 421 [[NSNotificationCenter defaultCenter] removeObserver:self];
422 422
423 [super dealloc]; 423 [super dealloc];
424 } 424 }
425 425
426 - (BOOL)allowsVibrancy {
427 // Returning YES will allow rendering this view with vibrancy effect if it is
428 // incorporated into a view hierarchy that uses vibrancy, it will have no
429 // effect otherwise.
430 // For details see Apple documentation on NSView and NSVisualEffectView.
431 return YES;
432 }
433
426 // Registers for the view for the appropriate drag types. 434 // Registers for the view for the appropriate drag types.
427 - (void)registerDragTypes { 435 - (void)registerDragTypes {
428 NSArray* types = [NSArray arrayWithObjects: 436 NSArray* types = [NSArray arrayWithObjects:
429 ui::kChromeDragDummyPboardType, 437 ui::kChromeDragDummyPboardType,
430 kWebURLsWithTitlesPboardType, 438 kWebURLsWithTitlesPboardType,
431 NSURLPboardType, 439 NSURLPboardType,
432 NSStringPboardType, 440 NSStringPboardType,
433 NSHTMLPboardType, 441 NSHTMLPboardType,
434 NSRTFPboardType, 442 NSRTFPboardType,
435 NSFilenamesPboardType, 443 NSFilenamesPboardType,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 - (BOOL)mouseDownCanMoveWindow { 480 - (BOOL)mouseDownCanMoveWindow {
473 // This is needed to prevent mouseDowns from moving the window 481 // This is needed to prevent mouseDowns from moving the window
474 // around. The default implementation returns YES only for opaque 482 // around. The default implementation returns YES only for opaque
475 // views. WebContentsViewCocoa does not draw itself in any way, but 483 // views. WebContentsViewCocoa does not draw itself in any way, but
476 // its subviews do paint their entire frames. Returning NO here 484 // its subviews do paint their entire frames. Returning NO here
477 // saves us the effort of overriding this method in every possible 485 // saves us the effort of overriding this method in every possible
478 // subview. 486 // subview.
479 return mouseDownCanMoveWindow_; 487 return mouseDownCanMoveWindow_;
480 } 488 }
481 489
490 - (void)setOpaque:(BOOL)opaque {
491 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
492 webContentsView_->web_contents()->GetRenderWidgetHostView());
493 DCHECK(view);
494 [view->cocoa_view() setOpaque:opaque];
495 }
496
482 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type { 497 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type {
483 [dragSource_ lazyWriteToPasteboard:sender 498 [dragSource_ lazyWriteToPasteboard:sender
484 forType:type]; 499 forType:type];
485 } 500 }
486 501
487 - (void)startDragWithDropData:(const DropData&)dropData 502 - (void)startDragWithDropData:(const DropData&)dropData
488 dragOperationMask:(NSDragOperation)operationMask 503 dragOperationMask:(NSDragOperation)operationMask
489 image:(NSImage*)image 504 image:(NSImage*)image
490 offset:(NSPoint)offset { 505 offset:(NSPoint)offset {
491 dragSource_.reset([[WebDragSource alloc] 506 dragSource_.reset([[WebDragSource alloc]
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 if (window && webContents) { 645 if (window && webContents) {
631 if ([window occlusionState] & NSWindowOcclusionStateVisible) { 646 if ([window occlusionState] & NSWindowOcclusionStateVisible) {
632 webContents->WasUnOccluded(); 647 webContents->WasUnOccluded();
633 } else { 648 } else {
634 webContents->WasOccluded(); 649 webContents->WasOccluded();
635 } 650 }
636 } 651 }
637 } 652 }
638 653
639 @end 654 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698