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