OLD | NEW |
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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 WebCursor web_cursor = cursor; | 1008 WebCursor web_cursor = cursor; |
1009 [cocoa_view_ updateCursor:web_cursor.GetNativeCursor()]; | 1009 [cocoa_view_ updateCursor:web_cursor.GetNativeCursor()]; |
1010 } | 1010 } |
1011 | 1011 |
1012 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { | 1012 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { |
1013 is_loading_ = is_loading; | 1013 is_loading_ = is_loading; |
1014 // If we ever decide to show the waiting cursor while the page is loading | 1014 // If we ever decide to show the waiting cursor while the page is loading |
1015 // like Chrome does on Windows, call |UpdateCursor()| here. | 1015 // like Chrome does on Windows, call |UpdateCursor()| here. |
1016 } | 1016 } |
1017 | 1017 |
1018 void RenderWidgetHostViewMac::TextInputStateChanged( | 1018 void RenderWidgetHostViewMac::UpdateInputMethodIfNecessary( |
1019 const ViewHostMsg_TextInputState_Params& params) { | 1019 bool text_input_state_changed) { |
1020 if (text_input_type_ != params.type | 1020 if (!text_input_state_changed) |
1021 || can_compose_inline_ != params.can_compose_inline) { | 1021 return; |
1022 text_input_type_ = params.type; | |
1023 can_compose_inline_ = params.can_compose_inline; | |
1024 if (HasFocus()) { | |
1025 SetTextInputActive(true); | |
1026 | 1022 |
1027 // Let AppKit cache the new input context to make IMEs happy. | 1023 if (HasFocus()) { |
1028 // See http://crbug.com/73039. | 1024 SetTextInputActive(true); |
1029 [NSApp updateWindows]; | 1025 |
| 1026 // Let AppKit cache the new input context to make IMEs happy. |
| 1027 // See http://crbug.com/73039. |
| 1028 [NSApp updateWindows]; |
1030 | 1029 |
1031 #ifndef __LP64__ | 1030 #ifndef __LP64__ |
1032 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline_); | 1031 UseInputWindow(TSMGetActiveDocument(), !render_widget_host_->delegate() |
| 1032 ->GetTextInputState() |
| 1033 .can_compose_inline); |
1033 #endif | 1034 #endif |
1034 } | |
1035 } | 1035 } |
1036 } | 1036 } |
1037 | 1037 |
1038 void RenderWidgetHostViewMac::ImeCancelComposition() { | 1038 void RenderWidgetHostViewMac::ImeCancelComposition() { |
1039 [cocoa_view_ cancelComposition]; | 1039 [cocoa_view_ cancelComposition]; |
1040 } | 1040 } |
1041 | 1041 |
1042 void RenderWidgetHostViewMac::ImeCompositionRangeChanged( | 1042 void RenderWidgetHostViewMac::ImeCompositionRangeChanged( |
1043 const gfx::Range& range, | 1043 const gfx::Range& range, |
1044 const std::vector<gfx::Rect>& character_bounds) { | 1044 const std::vector<gfx::Rect>& character_bounds) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 pepper_fullscreen_window_.autorelease(); | 1081 pepper_fullscreen_window_.autorelease(); |
1082 | 1082 |
1083 // Delete the delegated frame state, which will reach back into | 1083 // Delete the delegated frame state, which will reach back into |
1084 // render_widget_host_. | 1084 // render_widget_host_. |
1085 ShutdownBrowserCompositor(); | 1085 ShutdownBrowserCompositor(); |
1086 | 1086 |
1087 // Make sure none of our observers send events for us to process after | 1087 // Make sure none of our observers send events for us to process after |
1088 // we release render_widget_host_. | 1088 // we release render_widget_host_. |
1089 NotifyObserversAboutShutdown(); | 1089 NotifyObserversAboutShutdown(); |
1090 | 1090 |
| 1091 // The WebContentsImpl should be notified about us so that it will not hold |
| 1092 // an invalid text input state which was due to active text on this view. |
| 1093 NotifyHostDelegateAboutShutdown(); |
| 1094 |
1091 // We get this call just before |render_widget_host_| deletes | 1095 // We get this call just before |render_widget_host_| deletes |
1092 // itself. But we are owned by |cocoa_view_|, which may be retained | 1096 // itself. But we are owned by |cocoa_view_|, which may be retained |
1093 // by some other code. Examples are WebContentsViewMac's | 1097 // by some other code. Examples are WebContentsViewMac's |
1094 // |latent_focus_view_| and TabWindowController's | 1098 // |latent_focus_view_| and TabWindowController's |
1095 // |cachedContentView_|. | 1099 // |cachedContentView_|. |
1096 render_widget_host_ = NULL; | 1100 render_widget_host_ = NULL; |
1097 } | 1101 } |
1098 | 1102 |
1099 // Called from the renderer to tell us what the tooltip text should be. It | 1103 // Called from the renderer to tell us what the tooltip text should be. It |
1100 // calls us frequently so we need to cache the value to prevent doing a lot | 1104 // calls us frequently so we need to cache the value to prevent doing a lot |
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3524 | 3528 |
3525 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3529 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3526 // regions that are not draggable. (See ControlRegionView in | 3530 // regions that are not draggable. (See ControlRegionView in |
3527 // native_app_window_cocoa.mm). This requires the render host view to be | 3531 // native_app_window_cocoa.mm). This requires the render host view to be |
3528 // draggable by default. | 3532 // draggable by default. |
3529 - (BOOL)mouseDownCanMoveWindow { | 3533 - (BOOL)mouseDownCanMoveWindow { |
3530 return YES; | 3534 return YES; |
3531 } | 3535 } |
3532 | 3536 |
3533 @end | 3537 @end |
OLD | NEW |