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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 WebCursor web_cursor = cursor; | 1002 WebCursor web_cursor = cursor; |
1003 [cocoa_view_ updateCursor:web_cursor.GetNativeCursor()]; | 1003 [cocoa_view_ updateCursor:web_cursor.GetNativeCursor()]; |
1004 } | 1004 } |
1005 | 1005 |
1006 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { | 1006 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { |
1007 is_loading_ = is_loading; | 1007 is_loading_ = is_loading; |
1008 // If we ever decide to show the waiting cursor while the page is loading | 1008 // If we ever decide to show the waiting cursor while the page is loading |
1009 // like Chrome does on Windows, call |UpdateCursor()| here. | 1009 // like Chrome does on Windows, call |UpdateCursor()| here. |
1010 } | 1010 } |
1011 | 1011 |
1012 void RenderWidgetHostViewMac::TextInputStateChanged( | 1012 void RenderWidgetHostViewMac::UpdateInputMethodIfNecessary( |
1013 const ViewHostMsg_TextInputState_Params& params) { | 1013 bool text_input_state_changed) { |
1014 if (text_input_type_ != params.type | 1014 if (!text_input_state_changed) |
1015 || can_compose_inline_ != params.can_compose_inline) { | 1015 return; |
1016 text_input_type_ = params.type; | |
1017 can_compose_inline_ = params.can_compose_inline; | |
1018 if (HasFocus()) { | |
1019 SetTextInputActive(true); | |
1020 | 1016 |
1021 // Let AppKit cache the new input context to make IMEs happy. | 1017 if (HasFocus()) { |
1022 // See http://crbug.com/73039. | 1018 SetTextInputActive(true); |
1023 [NSApp updateWindows]; | 1019 |
| 1020 // Let AppKit cache the new input context to make IMEs happy. |
| 1021 // See http://crbug.com/73039. |
| 1022 [NSApp updateWindows]; |
1024 | 1023 |
1025 #ifndef __LP64__ | 1024 #ifndef __LP64__ |
1026 UseInputWindow(TSMGetActiveDocument(), !can_compose_inline_); | 1025 UseInputWindow(TSMGetActiveDocument(), !render_widget_host_->delegate() |
| 1026 ->GetTextInputState() |
| 1027 .can_compose_inline); |
1027 #endif | 1028 #endif |
1028 } | |
1029 } | 1029 } |
1030 } | 1030 } |
1031 | 1031 |
1032 void RenderWidgetHostViewMac::ImeCancelComposition() { | 1032 void RenderWidgetHostViewMac::ImeCancelComposition() { |
1033 [cocoa_view_ cancelComposition]; | 1033 [cocoa_view_ cancelComposition]; |
1034 } | 1034 } |
1035 | 1035 |
1036 void RenderWidgetHostViewMac::ImeCompositionRangeChanged( | 1036 void RenderWidgetHostViewMac::ImeCompositionRangeChanged( |
1037 const gfx::Range& range, | 1037 const gfx::Range& range, |
1038 const std::vector<gfx::Rect>& character_bounds) { | 1038 const std::vector<gfx::Rect>& character_bounds) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 pepper_fullscreen_window_.autorelease(); | 1075 pepper_fullscreen_window_.autorelease(); |
1076 | 1076 |
1077 // Delete the delegated frame state, which will reach back into | 1077 // Delete the delegated frame state, which will reach back into |
1078 // render_widget_host_. | 1078 // render_widget_host_. |
1079 ShutdownBrowserCompositor(); | 1079 ShutdownBrowserCompositor(); |
1080 | 1080 |
1081 // Make sure none of our observers send events for us to process after | 1081 // Make sure none of our observers send events for us to process after |
1082 // we release render_widget_host_. | 1082 // we release render_widget_host_. |
1083 NotifyObserversAboutShutdown(); | 1083 NotifyObserversAboutShutdown(); |
1084 | 1084 |
| 1085 // The WebContentsImpl should be notified about us so that it will not hold |
| 1086 // an invalid text input state which was due to active text on this view. |
| 1087 NotifyHostDelegateAboutShutdown(); |
| 1088 |
1085 // We get this call just before |render_widget_host_| deletes | 1089 // We get this call just before |render_widget_host_| deletes |
1086 // itself. But we are owned by |cocoa_view_|, which may be retained | 1090 // itself. But we are owned by |cocoa_view_|, which may be retained |
1087 // by some other code. Examples are WebContentsViewMac's | 1091 // by some other code. Examples are WebContentsViewMac's |
1088 // |latent_focus_view_| and TabWindowController's | 1092 // |latent_focus_view_| and TabWindowController's |
1089 // |cachedContentView_|. | 1093 // |cachedContentView_|. |
1090 render_widget_host_ = NULL; | 1094 render_widget_host_ = NULL; |
1091 } | 1095 } |
1092 | 1096 |
1093 // Called from the renderer to tell us what the tooltip text should be. It | 1097 // Called from the renderer to tell us what the tooltip text should be. It |
1094 // calls us frequently so we need to cache the value to prevent doing a lot | 1098 // calls us frequently so we need to cache the value to prevent doing a lot |
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3491 | 3495 |
3492 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3496 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3493 // regions that are not draggable. (See ControlRegionView in | 3497 // regions that are not draggable. (See ControlRegionView in |
3494 // native_app_window_cocoa.mm). This requires the render host view to be | 3498 // native_app_window_cocoa.mm). This requires the render host view to be |
3495 // draggable by default. | 3499 // draggable by default. |
3496 - (BOOL)mouseDownCanMoveWindow { | 3500 - (BOOL)mouseDownCanMoveWindow { |
3497 return YES; | 3501 return YES; |
3498 } | 3502 } |
3499 | 3503 |
3500 @end | 3504 @end |
OLD | NEW |