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" |
| 11 #include "ui/compositor/paint_context.h" |
11 #import "ui/events/cocoa/cocoa_event_utils.h" | 12 #import "ui/events/cocoa/cocoa_event_utils.h" |
12 #include "ui/events/keycodes/dom3/dom_code.h" | 13 #include "ui/events/keycodes/dom3/dom_code.h" |
13 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
14 #include "ui/gfx/canvas_paint_mac.h" | 15 #include "ui/gfx/canvas_paint_mac.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/strings/grit/ui_strings.h" | 17 #include "ui/strings/grit/ui_strings.h" |
17 #include "ui/views/controls/menu/menu_controller.h" | 18 #include "ui/views/controls/menu/menu_controller.h" |
18 #include "ui/views/ime/input_method.h" | 19 #include "ui/views/ime/input_method.h" |
19 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to | 278 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to |
278 // suppress calls to this when the window is known to be hidden. | 279 // suppress calls to this when the window is known to be hidden. |
279 if (!hostedView_) | 280 if (!hostedView_) |
280 return; | 281 return; |
281 | 282 |
282 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer(). | 283 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer(). |
283 if (hostedView_->GetWidget()->GetLayer()) | 284 if (hostedView_->GetWidget()->GetLayer()) |
284 return; | 285 return; |
285 | 286 |
286 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); | 287 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); |
287 hostedView_->GetWidget()->OnNativeWidgetPaint(&canvas); | 288 hostedView_->GetWidget()->OnNativeWidgetPaint(ui::PaintContext(&canvas)); |
288 } | 289 } |
289 | 290 |
290 - (NSTextInputContext*)inputContext { | 291 - (NSTextInputContext*)inputContext { |
291 if (!hostedView_) | 292 if (!hostedView_) |
292 return [super inputContext]; | 293 return [super inputContext]; |
293 | 294 |
294 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the | 295 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the |
295 // input context, return nil. This ensures the action message is sent to | 296 // input context, return nil. This ensures the action message is sent to |
296 // the view, rather than any NSTextInputClient a subview has installed. | 297 // the view, rather than any NSTextInputClient a subview has installed. |
297 MenuController* menuController = MenuController::GetActiveInstance(); | 298 MenuController* menuController = MenuController::GetActiveInstance(); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 } | 721 } |
721 | 722 |
722 return [super accessibilityAttributeValue:attribute]; | 723 return [super accessibilityAttributeValue:attribute]; |
723 } | 724 } |
724 | 725 |
725 - (id)accessibilityHitTest:(NSPoint)point { | 726 - (id)accessibilityHitTest:(NSPoint)point { |
726 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 727 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
727 } | 728 } |
728 | 729 |
729 @end | 730 @end |
OLD | NEW |