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 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 | 3104 |
3105 // Inserting text will delete all marked text automatically. | 3105 // Inserting text will delete all marked text automatically. |
3106 hasMarkedText_ = NO; | 3106 hasMarkedText_ = NO; |
3107 } | 3107 } |
3108 | 3108 |
3109 - (void)insertText:(id)string { | 3109 - (void)insertText:(id)string { |
3110 [self insertText:string replacementRange:NSMakeRange(NSNotFound, 0)]; | 3110 [self insertText:string replacementRange:NSMakeRange(NSNotFound, 0)]; |
3111 } | 3111 } |
3112 | 3112 |
3113 - (void)viewDidMoveToWindow { | 3113 - (void)viewDidMoveToWindow { |
3114 if ([self window]) { | 3114 if ([self window]) |
3115 [self updateScreenProperties]; | 3115 [self updateScreenProperties]; |
3116 } | |
3117 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( | 3116 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( |
3118 [self window]); | 3117 [self window]); |
3119 | 3118 |
3120 // If we switch windows (or are removed from the view hierarchy), cancel any | 3119 // If we switch windows (or are removed from the view hierarchy), cancel any |
3121 // open mouse-downs. | 3120 // open mouse-downs. |
3122 if (hasOpenMouseDown_) { | 3121 if (hasOpenMouseDown_) { |
3123 WebMouseEvent event; | 3122 WebMouseEvent event; |
3124 event.type = WebInputEvent::MouseUp; | 3123 event.type = WebInputEvent::MouseUp; |
3125 event.button = WebMouseEvent::ButtonLeft; | 3124 event.button = WebMouseEvent::ButtonLeft; |
3126 renderWidgetHostView_->ForwardMouseEvent(event); | 3125 renderWidgetHostView_->ForwardMouseEvent(event); |
3127 | 3126 |
3128 hasOpenMouseDown_ = NO; | 3127 hasOpenMouseDown_ = NO; |
3129 } | 3128 } |
3130 } | 3129 } |
3131 | 3130 |
| 3131 - (void)viewDidChangeBackingProperties { |
| 3132 NSScreen* screen = [[self window] screen]; |
| 3133 if (screen) { |
| 3134 renderWidgetHostView_->browser_compositor_->SetDisplayColorSpace( |
| 3135 gfx::ColorSpace::FromCGColorSpace([[screen colorSpace] CGColorSpace])); |
| 3136 } |
| 3137 } |
| 3138 |
3132 - (void)undo:(id)sender { | 3139 - (void)undo:(id)sender { |
3133 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); | 3140 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); |
3134 if (web_contents) | 3141 if (web_contents) |
3135 web_contents->Undo(); | 3142 web_contents->Undo(); |
3136 } | 3143 } |
3137 | 3144 |
3138 - (void)redo:(id)sender { | 3145 - (void)redo:(id)sender { |
3139 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); | 3146 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); |
3140 if (web_contents) | 3147 if (web_contents) |
3141 web_contents->Redo(); | 3148 web_contents->Redo(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3300 | 3307 |
3301 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3308 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3302 // regions that are not draggable. (See ControlRegionView in | 3309 // regions that are not draggable. (See ControlRegionView in |
3303 // native_app_window_cocoa.mm). This requires the render host view to be | 3310 // native_app_window_cocoa.mm). This requires the render host view to be |
3304 // draggable by default. | 3311 // draggable by default. |
3305 - (BOOL)mouseDownCanMoveWindow { | 3312 - (BOOL)mouseDownCanMoveWindow { |
3306 return YES; | 3313 return YES; |
3307 } | 3314 } |
3308 | 3315 |
3309 @end | 3316 @end |
OLD | NEW |