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

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: 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 return YES;
Alexei Svitkine (slow) 2015/01/22 16:41:21 What's the effect of returning YES here? Does it
joleksy 2015/01/23 07:24:01 By itself it does not change anything, from the do
428 }
429
426 // Registers for the view for the appropriate drag types. 430 // Registers for the view for the appropriate drag types.
427 - (void)registerDragTypes { 431 - (void)registerDragTypes {
428 NSArray* types = [NSArray arrayWithObjects: 432 NSArray* types = [NSArray arrayWithObjects:
429 ui::kChromeDragDummyPboardType, 433 ui::kChromeDragDummyPboardType,
430 kWebURLsWithTitlesPboardType, 434 kWebURLsWithTitlesPboardType,
431 NSURLPboardType, 435 NSURLPboardType,
432 NSStringPboardType, 436 NSStringPboardType,
433 NSHTMLPboardType, 437 NSHTMLPboardType,
434 NSRTFPboardType, 438 NSRTFPboardType,
435 NSFilenamesPboardType, 439 NSFilenamesPboardType,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 - (BOOL)mouseDownCanMoveWindow { 476 - (BOOL)mouseDownCanMoveWindow {
473 // This is needed to prevent mouseDowns from moving the window 477 // This is needed to prevent mouseDowns from moving the window
474 // around. The default implementation returns YES only for opaque 478 // around. The default implementation returns YES only for opaque
475 // views. WebContentsViewCocoa does not draw itself in any way, but 479 // views. WebContentsViewCocoa does not draw itself in any way, but
476 // its subviews do paint their entire frames. Returning NO here 480 // its subviews do paint their entire frames. Returning NO here
477 // saves us the effort of overriding this method in every possible 481 // saves us the effort of overriding this method in every possible
478 // subview. 482 // subview.
479 return mouseDownCanMoveWindow_; 483 return mouseDownCanMoveWindow_;
480 } 484 }
481 485
486 - (void)setOpaque:(BOOL)opaque {
487 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
488 webContentsView_->web_contents()->GetRenderWidgetHostView());
489 DCHECK(view);
490 [view->cocoa_view() setOpaque:opaque];
491 }
492
482 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type { 493 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type {
483 [dragSource_ lazyWriteToPasteboard:sender 494 [dragSource_ lazyWriteToPasteboard:sender
484 forType:type]; 495 forType:type];
485 } 496 }
486 497
487 - (void)startDragWithDropData:(const DropData&)dropData 498 - (void)startDragWithDropData:(const DropData&)dropData
488 dragOperationMask:(NSDragOperation)operationMask 499 dragOperationMask:(NSDragOperation)operationMask
489 image:(NSImage*)image 500 image:(NSImage*)image
490 offset:(NSPoint)offset { 501 offset:(NSPoint)offset {
491 dragSource_.reset([[WebDragSource alloc] 502 dragSource_.reset([[WebDragSource alloc]
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 if (window && webContents) { 641 if (window && webContents) {
631 if ([window occlusionState] & NSWindowOcclusionStateVisible) { 642 if ([window occlusionState] & NSWindowOcclusionStateVisible) {
632 webContents->WasUnOccluded(); 643 webContents->WasUnOccluded();
633 } else { 644 } else {
634 webContents->WasOccluded(); 645 webContents->WasOccluded();
635 } 646 }
636 } 647 }
637 } 648 }
638 649
639 @end 650 @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