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

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 1815563002: MacViews: Enable acceptsFirstMouse for BridgedContentView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 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
« no previous file with comments | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/bridged_content_view.h" 5 #import "ui/views/cocoa/bridged_content_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer(). 504 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer().
505 if (hostedView_->GetWidget()->GetLayer()) 505 if (hostedView_->GetWidget()->GetLayer())
506 return; 506 return;
507 507
508 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); 508 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */);
509 hostedView_->GetWidget()->OnNativeWidgetPaint( 509 hostedView_->GetWidget()->OnNativeWidgetPaint(
510 ui::CanvasPainter(&canvas, 1.f).context()); 510 ui::CanvasPainter(&canvas, 1.f).context());
511 } 511 }
512 512
513 // To maximize consistency with the Cocoa browser (mac_views_browser=0), accept
514 // mouse clicks immediately so that clicking on Chrome from an inactive window
515 // will allow the event to be processed, rather than merely activate the window.
516 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
517 return YES;
518 }
519
513 - (NSTextInputContext*)inputContext { 520 - (NSTextInputContext*)inputContext {
514 // If the textInputClient_ does not exist, return nil since this view does not 521 // If the textInputClient_ does not exist, return nil since this view does not
515 // conform to NSTextInputClient protocol. 522 // conform to NSTextInputClient protocol.
516 if (!textInputClient_) 523 if (!textInputClient_)
517 return nil; 524 return nil;
518 525
519 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the 526 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the
520 // input context, return nil. This ensures the action message is sent to 527 // input context, return nil. This ensures the action message is sent to
521 // the view, rather than any NSTextInputClient a subview has installed. 528 // the view, rather than any NSTextInputClient a subview has installed.
522 MenuController* menuController = MenuController::GetActiveInstance(); 529 MenuController* menuController = MenuController::GetActiveInstance();
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } 927 }
921 928
922 return [super accessibilityAttributeValue:attribute]; 929 return [super accessibilityAttributeValue:attribute];
923 } 930 }
924 931
925 - (id)accessibilityHitTest:(NSPoint)point { 932 - (id)accessibilityHitTest:(NSPoint)point {
926 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 933 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
927 } 934 }
928 935
929 @end 936 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698