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 | 10 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 // on NSApplicationDidChangeScreenParametersNotification. Only one observer | 347 // on NSApplicationDidChangeScreenParametersNotification. Only one observer |
348 // is necessary. | 348 // is necessary. |
349 bool g_screen_info_up_to_date = false; | 349 bool g_screen_info_up_to_date = false; |
350 | 350 |
351 float FlipYFromRectToScreen(float y, float rect_height) { | 351 float FlipYFromRectToScreen(float y, float rect_height) { |
352 TRACE_EVENT0("browser", "FlipYFromRectToScreen"); | 352 TRACE_EVENT0("browser", "FlipYFromRectToScreen"); |
353 static CGFloat screen_zero_height = 0; | 353 static CGFloat screen_zero_height = 0; |
354 if (!g_screen_info_up_to_date) { | 354 if (!g_screen_info_up_to_date) { |
355 if ([[NSScreen screens] count] > 0) { | 355 if ([[NSScreen screens] count] > 0) { |
356 screen_zero_height = | 356 screen_zero_height = |
357 [[[NSScreen screens] objectAtIndex:0] frame].size.height; | 357 [[[NSScreen screens] firstObject] frame].size.height; |
358 g_screen_info_up_to_date = true; | 358 g_screen_info_up_to_date = true; |
359 } else { | 359 } else { |
360 return y; | 360 return y; |
361 } | 361 } |
362 } | 362 } |
363 return screen_zero_height - y - rect_height; | 363 return screen_zero_height - y - rect_height; |
364 } | 364 } |
365 | 365 |
366 // Adjusts an NSRect in Cocoa screen coordinates to have an origin in the upper | 366 // Adjusts an NSRect in Cocoa screen coordinates to have an origin in the upper |
367 // left of the primary screen (Carbon coordinates), and stuffs it into a | 367 // left of the primary screen (Carbon coordinates), and stuffs it into a |
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3480 | 3480 |
3481 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3481 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3482 // regions that are not draggable. (See ControlRegionView in | 3482 // regions that are not draggable. (See ControlRegionView in |
3483 // native_app_window_cocoa.mm). This requires the render host view to be | 3483 // native_app_window_cocoa.mm). This requires the render host view to be |
3484 // draggable by default. | 3484 // draggable by default. |
3485 - (BOOL)mouseDownCanMoveWindow { | 3485 - (BOOL)mouseDownCanMoveWindow { |
3486 return YES; | 3486 return YES; |
3487 } | 3487 } |
3488 | 3488 |
3489 @end | 3489 @end |
OLD | NEW |