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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
6 | 6 |
7 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification; | 75 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification; |
76 - (content::WebContentsImpl*)webContents; | 76 - (content::WebContentsImpl*)webContents; |
77 @end | 77 @end |
78 | 78 |
79 namespace { | 79 namespace { |
80 | 80 |
81 content::ScreenInfo GetNSViewScreenInfo(NSView* view) { | 81 content::ScreenInfo GetNSViewScreenInfo(NSView* view) { |
82 display::Display display = | 82 display::Display display = |
83 display::Screen::GetScreen()->GetDisplayNearestWindow(view); | 83 display::Screen::GetScreen()->GetDisplayNearestWindow(view); |
84 | 84 |
| 85 NSScreen* screen = [NSScreen deepestScreen]; |
| 86 |
85 content::ScreenInfo results; | 87 content::ScreenInfo results; |
| 88 |
86 results.device_scale_factor = static_cast<int>(display.device_scale_factor()); | 89 results.device_scale_factor = static_cast<int>(display.device_scale_factor()); |
87 results.icc_profile = display.icc_profile(); | 90 results.depth = NSBitsPerPixelFromDepth([screen depth]); |
88 results.depth = display.color_depth(); | 91 results.depth_per_component = NSBitsPerSampleFromDepth([screen depth]); |
89 results.depth_per_component = display.depth_per_component(); | 92 results.is_monochrome = |
90 results.is_monochrome = display.is_monochrome(); | 93 [[screen colorSpace] colorSpaceModel] == NSGrayColorSpaceModel; |
91 results.rect = display.bounds(); | 94 results.rect = display.bounds(); |
92 results.available_rect = display.work_area(); | 95 results.available_rect = display.work_area(); |
93 results.orientation_angle = display.RotationAsDegree(); | 96 results.orientation_angle = display.RotationAsDegree(); |
94 results.orientation_type = | 97 results.orientation_type = |
95 content::RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); | 98 content::RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); |
96 | 99 |
97 return results; | 100 return results; |
98 } | 101 } |
99 | 102 |
100 } // namespace | 103 } // namespace |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 714 |
712 - (void)viewDidHide { | 715 - (void)viewDidHide { |
713 [self updateWebContentsVisibility]; | 716 [self updateWebContentsVisibility]; |
714 } | 717 } |
715 | 718 |
716 - (void)viewDidUnhide { | 719 - (void)viewDidUnhide { |
717 [self updateWebContentsVisibility]; | 720 [self updateWebContentsVisibility]; |
718 } | 721 } |
719 | 722 |
720 @end | 723 @end |
OLD | NEW |