| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
| 10 #import "base/chrome_application_mac.h" | 10 #import "base/chrome_application_mac.h" |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 839 |
| 840 plugin_container_manager_.SetSurfaceWasPaintedTo(window); | 840 plugin_container_manager_.SetSurfaceWasPaintedTo(window); |
| 841 AcceleratedPluginView* view = | 841 AcceleratedPluginView* view = |
| 842 static_cast<AcceleratedPluginView*>(it->second); | 842 static_cast<AcceleratedPluginView*>(it->second); |
| 843 // The surface is hidden until its first paint, to not show gargabe. | 843 // The surface is hidden until its first paint, to not show gargabe. |
| 844 if (plugin_container_manager_.SurfaceShouldBeVisible(window)) | 844 if (plugin_container_manager_.SurfaceShouldBeVisible(window)) |
| 845 [view setHidden:NO]; | 845 [view setHidden:NO]; |
| 846 [view setSurfaceWasSwapped:YES]; | 846 [view setSurfaceWasSwapped:YES]; |
| 847 } | 847 } |
| 848 | 848 |
| 849 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { |
| 850 // Plugins are destroyed on page navigate. The compositor layer on the other |
| 851 // hand is created on demand and then stays alive until its renderer process |
| 852 // dies (usually on cross-domain navigation). Instead, only a flag |
| 853 // |is_gpu_rendering_active()| is flipped when the compositor output should be |
| 854 // shown/hidden. |
| 855 // Show/hide the view belonging to the compositor here. |
| 856 plugin_container_manager_.set_gpu_rendering_active( |
| 857 GetRenderWidgetHost()->is_gpu_rendering_active()); |
| 858 |
| 859 gfx::PluginWindowHandle root_handle = |
| 860 plugin_container_manager_.root_container_handle(); |
| 861 if (root_handle != gfx::kNullPluginWindow) { |
| 862 PluginViewMap::iterator it = plugin_views_.find(root_handle); |
| 863 DCHECK(plugin_views_.end() != it); |
| 864 if (plugin_views_.end() == it) { |
| 865 return; |
| 866 } |
| 867 bool visible = |
| 868 plugin_container_manager_.SurfaceShouldBeVisible(root_handle); |
| 869 [it->second setHidden:!visible]; |
| 870 } |
| 871 } |
| 872 |
| 849 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( | 873 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( |
| 850 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) { | 874 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) { |
| 851 // Called on the display link thread. | 875 // Called on the display link thread. |
| 852 PluginViewMap::iterator it = plugin_views_.find(plugin_handle); | 876 PluginViewMap::iterator it = plugin_views_.find(plugin_handle); |
| 853 DCHECK(plugin_views_.end() != it); | 877 DCHECK(plugin_views_.end() != it); |
| 854 if (plugin_views_.end() == it) { | 878 if (plugin_views_.end() == it) { |
| 855 return; | 879 return; |
| 856 } | 880 } |
| 857 CGLSetCurrentContext(context); | 881 CGLSetCurrentContext(context); |
| 858 // TODO(thakis): Pixel or view coordinates? | 882 // TODO(thakis): Pixel or view coordinates? |
| 859 NSSize size = [it->second frame].size; | 883 NSSize size = [it->second frame].size; |
| 860 | 884 |
| 861 glMatrixMode(GL_PROJECTION); | 885 glMatrixMode(GL_PROJECTION); |
| 862 glLoadIdentity(); | 886 glLoadIdentity(); |
| 863 // Note that we place the origin at the upper left corner with +y | 887 // Note that we place the origin at the upper left corner with +y |
| 864 // going down | 888 // going down |
| 865 glOrtho(0, size.width, size.height, 0, -1, 1); | 889 glOrtho(0, size.width, size.height, 0, -1, 1); |
| 866 glMatrixMode(GL_MODELVIEW); | 890 glMatrixMode(GL_MODELVIEW); |
| 867 glLoadIdentity(); | 891 glLoadIdentity(); |
| 868 | 892 |
| 869 plugin_container_manager_.Draw( | 893 plugin_container_manager_.Draw(context, plugin_handle); |
| 870 context, | |
| 871 plugin_handle, | |
| 872 GetRenderWidgetHost()->is_gpu_rendering_active()); | |
| 873 } | 894 } |
| 874 | 895 |
| 875 void RenderWidgetHostViewMac::ForceTextureReload() { | 896 void RenderWidgetHostViewMac::ForceTextureReload() { |
| 876 plugin_container_manager_.ForceTextureReload(); | 897 plugin_container_manager_.ForceTextureReload(); |
| 877 } | 898 } |
| 878 | 899 |
| 879 void RenderWidgetHostViewMac::SetVisuallyDeemphasized(bool deemphasized) { | 900 void RenderWidgetHostViewMac::SetVisuallyDeemphasized(bool deemphasized) { |
| 880 // Mac uses tab-modal sheets, so this is a no-op. | 901 // Mac uses tab-modal sheets, so this is a no-op. |
| 881 } | 902 } |
| 882 | 903 |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 if (!string) return NO; | 2338 if (!string) return NO; |
| 2318 | 2339 |
| 2319 // If the user is currently using an IME, confirm the IME input, | 2340 // If the user is currently using an IME, confirm the IME input, |
| 2320 // and then insert the text from the service, the same as TextEdit and Safari. | 2341 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2321 [self confirmComposition]; | 2342 [self confirmComposition]; |
| 2322 [self insertText:string]; | 2343 [self insertText:string]; |
| 2323 return YES; | 2344 return YES; |
| 2324 } | 2345 } |
| 2325 | 2346 |
| 2326 @end | 2347 @end |
| OLD | NEW |