| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // RenderWidgetHostViewMac, public: | 588 // RenderWidgetHostViewMac, public: |
| 589 | 589 |
| 590 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) | 590 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) |
| 591 : render_widget_host_(widget), | 591 : render_widget_host_(widget), |
| 592 about_to_validate_and_paint_(false), | 592 about_to_validate_and_paint_(false), |
| 593 call_set_needs_display_in_rect_pending_(false), | 593 call_set_needs_display_in_rect_pending_(false), |
| 594 text_input_type_(WebKit::WebTextInputTypeNone), | 594 text_input_type_(WebKit::WebTextInputTypeNone), |
| 595 is_loading_(false), | 595 is_loading_(false), |
| 596 is_hidden_(false), | 596 is_hidden_(false), |
| 597 shutdown_factory_(this), | 597 shutdown_factory_(this), |
| 598 needs_gpu_visibility_update_after_repaint_(false) { | 598 needs_gpu_visibility_update_after_repaint_(false), |
| 599 compositing_surface_(gfx::kNullPluginWindow) { |
| 599 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away. | 600 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away. |
| 600 // Since we autorelease it, our caller must put |native_view()| into the view | 601 // Since we autorelease it, our caller must put |native_view()| into the view |
| 601 // hierarchy right after calling us. | 602 // hierarchy right after calling us. |
| 602 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] | 603 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] |
| 603 initWithRenderWidgetHostViewMac:this] autorelease]; | 604 initWithRenderWidgetHostViewMac:this] autorelease]; |
| 604 render_widget_host_->set_view(this); | 605 render_widget_host_->set_view(this); |
| 605 | 606 |
| 606 // Turn on accessibility only if VoiceOver is running. | 607 // Turn on accessibility only if VoiceOver is running. |
| 607 if (IsVoiceOverRunning()) { | 608 if (IsVoiceOverRunning()) { |
| 608 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 609 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 925 } |
| 925 | 926 |
| 926 void RenderWidgetHostViewMac::RenderViewGone(base::TerminationStatus status, | 927 void RenderWidgetHostViewMac::RenderViewGone(base::TerminationStatus status, |
| 927 int error_code) { | 928 int error_code) { |
| 928 // TODO(darin): keep this around, and draw sad-tab into it. | 929 // TODO(darin): keep this around, and draw sad-tab into it. |
| 929 UpdateCursorIfOverSelf(); | 930 UpdateCursorIfOverSelf(); |
| 930 Destroy(); | 931 Destroy(); |
| 931 } | 932 } |
| 932 | 933 |
| 933 void RenderWidgetHostViewMac::Destroy() { | 934 void RenderWidgetHostViewMac::Destroy() { |
| 935 // TODO(backer): Do we need to dealloc compositing_surface_? |
| 936 |
| 934 // On Windows, popups are implemented with a popup window style, so that when | 937 // On Windows, popups are implemented with a popup window style, so that when |
| 935 // an event comes in that would "cancel" it, it receives the OnCancelMode | 938 // an event comes in that would "cancel" it, it receives the OnCancelMode |
| 936 // message and can kill itself. Alas, on the Mac, views cannot capture events | 939 // message and can kill itself. Alas, on the Mac, views cannot capture events |
| 937 // outside of themselves. On Windows, if Destroy is being called on a view, | 940 // outside of themselves. On Windows, if Destroy is being called on a view, |
| 938 // then the event causing the destroy had also cancelled any popups by the | 941 // then the event causing the destroy had also cancelled any popups by the |
| 939 // time Destroy() was called. On the Mac we have to destroy all the popups | 942 // time Destroy() was called. On the Mac we have to destroy all the popups |
| 940 // ourselves. | 943 // ourselves. |
| 941 | 944 |
| 942 // Depth-first destroy all popups. Use ShutdownHost() to enforce | 945 // Depth-first destroy all popups. Use ShutdownHost() to enforce |
| 943 // deepest-first ordering. | 946 // deepest-first ordering. |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { | 1293 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { |
| 1291 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1294 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1292 if (GetRenderWidgetHost()->is_accelerated_compositing_active()) { | 1295 if (GetRenderWidgetHost()->is_accelerated_compositing_active()) { |
| 1293 UpdateRootGpuViewVisibility( | 1296 UpdateRootGpuViewVisibility( |
| 1294 GetRenderWidgetHost()->is_accelerated_compositing_active()); | 1297 GetRenderWidgetHost()->is_accelerated_compositing_active()); |
| 1295 } else { | 1298 } else { |
| 1296 needs_gpu_visibility_update_after_repaint_ = true; | 1299 needs_gpu_visibility_update_after_repaint_ = true; |
| 1297 } | 1300 } |
| 1298 } | 1301 } |
| 1299 | 1302 |
| 1300 gfx::PluginWindowHandle RenderWidgetHostViewMac::AcquireCompositingSurface() { | 1303 gfx::PluginWindowHandle RenderWidgetHostViewMac::GetCompositingSurface() { |
| 1301 return AllocateFakePluginWindowHandle(/*opaque=*/true, /*root=*/true); | 1304 if (compositing_surface_ == gfx::kNullPluginWindow) |
| 1302 } | 1305 compositing_surface_ = AllocateFakePluginWindowHandle( |
| 1303 | 1306 /*opaque=*/true, /*root=*/true); |
| 1304 void RenderWidgetHostViewMac::ReleaseCompositingSurface( | 1307 return compositing_surface_; |
| 1305 gfx::PluginWindowHandle surface) { | |
| 1306 DestroyFakePluginWindowHandle(surface); | |
| 1307 } | 1308 } |
| 1308 | 1309 |
| 1309 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( | 1310 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( |
| 1310 CGLContextObj context, | 1311 CGLContextObj context, |
| 1311 gfx::PluginWindowHandle plugin_handle, | 1312 gfx::PluginWindowHandle plugin_handle, |
| 1312 NSSize size) { | 1313 NSSize size) { |
| 1313 // Called on the display link thread. | 1314 // Called on the display link thread. |
| 1314 CGLSetCurrentContext(context); | 1315 CGLSetCurrentContext(context); |
| 1315 | 1316 |
| 1316 glMatrixMode(GL_PROJECTION); | 1317 glMatrixMode(GL_PROJECTION); |
| (...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 if (!string) return NO; | 2938 if (!string) return NO; |
| 2938 | 2939 |
| 2939 // If the user is currently using an IME, confirm the IME input, | 2940 // If the user is currently using an IME, confirm the IME input, |
| 2940 // and then insert the text from the service, the same as TextEdit and Safari. | 2941 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2941 [self confirmComposition]; | 2942 [self confirmComposition]; |
| 2942 [self insertText:string]; | 2943 [self insertText:string]; |
| 2943 return YES; | 2944 return YES; |
| 2944 } | 2945 } |
| 2945 | 2946 |
| 2946 @end | 2947 @end |
| OLD | NEW |