| 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 "remoting/host/desktop_resizer.h" | 5 #include "remoting/host/desktop_resizer.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | |
| 11 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 13 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "remoting/base/logging.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 // TODO(jamiewalch): Use the correct DPI for the mode: http://crbug.com/172405. | 16 // TODO(jamiewalch): Use the correct DPI for the mode: http://crbug.com/172405. |
| 17 const int kDefaultDPI = 96; | 17 const int kDefaultDPI = 96; |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | 21 |
| 22 class DesktopResizerMac : public DesktopResizer { | 22 class DesktopResizerMac : public DesktopResizer { |
| 23 public: | 23 public: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 kCFCompareCaseInsensitive) == kCFCompareEqualTo) { | 97 kCFCompareCaseInsensitive) == kCFCompareEqualTo) { |
| 98 depth = 8; | 98 depth = 8; |
| 99 } | 99 } |
| 100 if (depth > best_depth) { | 100 if (depth > best_depth) { |
| 101 best_depth = depth; | 101 best_depth = depth; |
| 102 best_mode = mode; | 102 best_mode = mode; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 if (best_mode) { | 106 if (best_mode) { |
| 107 LOG(INFO) << "Changing mode to " << best_mode << " (" | 107 LOG_INFO << "Changing mode to " << best_mode << " (" |
| 108 << resolution.dimensions().width() << "x" | 108 << resolution.dimensions().width() << "x" |
| 109 << "x" << resolution.dimensions().height() << "x" | 109 << "x" << resolution.dimensions().height() << "x" |
| 110 << best_depth << " @ " | 110 << best_depth << " @ " |
| 111 << resolution.dpi().x() << "x" << resolution.dpi().y() << " dpi)"; | 111 << resolution.dpi().x() << "x" << resolution.dpi().y() << " dpi)"; |
| 112 CGDisplaySetDisplayMode(display, best_mode, NULL); | 112 CGDisplaySetDisplayMode(display, best_mode, NULL); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 void DesktopResizerMac::RestoreResolution(const ScreenResolution& original) { | 116 void DesktopResizerMac::RestoreResolution(const ScreenResolution& original) { |
| 117 SetResolution(original); | 117 SetResolution(original); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 *display = displays[0]; | 165 *display = displays[0]; |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 scoped_ptr<DesktopResizer> DesktopResizer::Create() { | 169 scoped_ptr<DesktopResizer> DesktopResizer::Create() { |
| 170 return scoped_ptr<DesktopResizer>(new DesktopResizerMac); | 170 return scoped_ptr<DesktopResizer>(new DesktopResizerMac); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace remoting | 173 } // namespace remoting |
| OLD | NEW |