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

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

Issue 1207973002: Fixes for views_unittests on Mac after InputMethodBridge removal (DO NOT COMMIT) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150625-IMERefactorMac-UPSTREAM
Patch Set: Created 5 years, 5 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
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_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 bool shows_fullscreen_controls = 700 bool shows_fullscreen_controls =
701 is_resizable && widget->widget_delegate()->CanMaximize(); 701 is_resizable && widget->widget_delegate()->CanMaximize();
702 702
703 gfx::ApplyNSWindowSizeConstraints(window_, min_size, max_size, 703 gfx::ApplyNSWindowSizeConstraints(window_, min_size, max_size,
704 shows_resize_controls, 704 shows_resize_controls,
705 shows_fullscreen_controls); 705 shows_fullscreen_controls);
706 } 706 }
707 707
708 ui::InputMethod* BridgedNativeWidget::GetInputMethod() { 708 ui::InputMethod* BridgedNativeWidget::GetInputMethod() {
709 if (!input_method_) { 709 if (!input_method_) {
710 // Delegate is NULL because Mac IME does not need DispatchKeyEventPostIME 710 input_method_ = ui::CreateInputMethod(this, nil);
tapted 2015/06/25 11:54:14 I think this was true (and worked OK) when InputMe
711 // callbacks.
712 input_method_ = ui::CreateInputMethod(NULL, nil);
713 input_method_->OnFocus(); 711 input_method_->OnFocus();
714 } 712 }
715 return input_method_.get(); 713 return input_method_.get();
716 } 714 }
717 715
718 gfx::Rect BridgedNativeWidget::GetRestoredBounds() const { 716 gfx::Rect BridgedNativeWidget::GetRestoredBounds() const {
719 if (target_fullscreen_state_ || in_fullscreen_transition_) 717 if (target_fullscreen_state_ || in_fullscreen_transition_)
720 return bounds_before_fullscreen_; 718 return bounds_before_fullscreen_;
721 719
722 return gfx::ScreenRectFromNSRect([window_ frame]); 720 return gfx::ScreenRectFromNSRect([window_ frame]);
(...skipping 20 matching lines...) Expand all
743 layer()->SetFillsBoundsOpaquely(!translucent); 741 layer()->SetFillsBoundsOpaquely(!translucent);
744 if (translucent) { 742 if (translucent) {
745 [window_ setOpaque:NO]; 743 [window_ setOpaque:NO];
746 [window_ setBackgroundColor:[NSColor clearColor]]; 744 [window_ setBackgroundColor:[NSColor clearColor]];
747 } 745 }
748 746
749 UpdateLayerProperties(); 747 UpdateLayerProperties();
750 } 748 }
751 749
752 //////////////////////////////////////////////////////////////////////////////// 750 ////////////////////////////////////////////////////////////////////////////////
751 // BridgedNativeWidget, internal::InputMethodDelegate:
752
753 bool BridgedNativeWidget::DispatchKeyEventPostIME(const ui::KeyEvent& key) {
754 DCHECK(focus_manager_);
755 native_widget_mac_->GetWidget()->OnKeyEvent(const_cast<ui::KeyEvent*>(&key));
756 if (!key.handled())
757 focus_manager_->OnKeyEvent(key);
758 return key.handled();
759 }
760
761 ////////////////////////////////////////////////////////////////////////////////
753 // BridgedNativeWidget, CocoaMouseCaptureDelegate: 762 // BridgedNativeWidget, CocoaMouseCaptureDelegate:
754 763
755 void BridgedNativeWidget::PostCapturedEvent(NSEvent* event) { 764 void BridgedNativeWidget::PostCapturedEvent(NSEvent* event) {
756 [bridged_view_ processCapturedMouseEvent:event]; 765 [bridged_view_ processCapturedMouseEvent:event];
757 } 766 }
758 767
759 void BridgedNativeWidget::OnMouseCaptureLost() { 768 void BridgedNativeWidget::OnMouseCaptureLost() {
760 native_widget_mac_->GetWidget()->OnMouseCaptureLost(); 769 native_widget_mac_->GetWidget()->OnMouseCaptureLost();
761 } 770 }
762 771
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1022 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1014 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1023 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1015 // changes. Previously we tried adding an NSView and removing it, but for some 1024 // changes. Previously we tried adding an NSView and removing it, but for some
1016 // reason it required reposting the mouse-down event, and didn't always work. 1025 // reason it required reposting the mouse-down event, and didn't always work.
1017 // Calling the below seems to be an effective solution. 1026 // Calling the below seems to be an effective solution.
1018 [window_ setMovableByWindowBackground:NO]; 1027 [window_ setMovableByWindowBackground:NO];
1019 [window_ setMovableByWindowBackground:YES]; 1028 [window_ setMovableByWindowBackground:YES];
1020 } 1029 }
1021 1030
1022 } // namespace views 1031 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698