OLD | NEW |
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/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "ui/base/ime/text_input_client.h" | 10 #include "ui/base/ime/text_input_client.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 hostedView_->GetWidget()->OnMouseEvent(&event); | 70 hostedView_->GetWidget()->OnMouseEvent(&event); |
71 } | 71 } |
72 | 72 |
73 - (void)doCommandByID:(int)commandId { | 73 - (void)doCommandByID:(int)commandId { |
74 if (textInputClient_ && textInputClient_->IsEditingCommandEnabled(commandId)) | 74 if (textInputClient_ && textInputClient_->IsEditingCommandEnabled(commandId)) |
75 textInputClient_->ExecuteEditingCommand(commandId); | 75 textInputClient_->ExecuteEditingCommand(commandId); |
76 } | 76 } |
77 | 77 |
78 // NSView implementation. | 78 // NSView implementation. |
79 | 79 |
| 80 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { |
| 81 return YES; |
| 82 } |
| 83 |
80 - (BOOL)acceptsFirstResponder { | 84 - (BOOL)acceptsFirstResponder { |
81 return YES; | 85 return YES; |
82 } | 86 } |
83 | 87 |
84 - (void)setFrameSize:(NSSize)newSize { | 88 - (void)setFrameSize:(NSSize)newSize { |
85 [super setFrameSize:newSize]; | 89 [super setFrameSize:newSize]; |
86 if (!hostedView_) | 90 if (!hostedView_) |
87 return; | 91 return; |
88 | 92 |
89 hostedView_->SetSize(gfx::Size(newSize.width, newSize.height)); | 93 hostedView_->SetSize(gfx::Size(newSize.width, newSize.height)); |
90 } | 94 } |
91 | 95 |
92 - (void)drawRect:(NSRect)dirtyRect { | 96 - (void)drawRect:(NSRect)dirtyRect { |
93 // Note that on a Show, Cocoa calls drawRect: before changing | 97 // Note that on a Show, Cocoa calls drawRect: before changing |
94 // -[NSWindow isVisible], hence the extra check. | 98 // -[NSWindow isVisible], hence the extra check. |
95 if (!hostedView_ || (!willShow_ && ![[self window] isVisible])) | 99 if (!hostedView_ || [self wantsLayer] || (!willShow_ && ![[self window] isVisi
ble])) |
96 return; | 100 return; |
97 | 101 |
98 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); | 102 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); |
99 hostedView_->GetWidget()->OnNativeWidgetPaint(&canvas); | 103 hostedView_->GetWidget()->OnNativeWidgetPaint(&canvas); |
100 } | 104 } |
101 | 105 |
102 // NSResponder implementation. | 106 // NSResponder implementation. |
103 | 107 |
104 - (void)keyDown:(NSEvent*)theEvent { | 108 - (void)keyDown:(NSEvent*)theEvent { |
105 if (textInputClient_) | 109 if (textInputClient_) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 322 } |
319 | 323 |
320 return [super accessibilityAttributeValue:attribute]; | 324 return [super accessibilityAttributeValue:attribute]; |
321 } | 325 } |
322 | 326 |
323 - (id)accessibilityHitTest:(NSPoint)point { | 327 - (id)accessibilityHitTest:(NSPoint)point { |
324 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 328 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
325 } | 329 } |
326 | 330 |
327 @end | 331 @end |
OLD | NEW |