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