| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/video/linux/video_capture_device_chromeos.h" | 5 #include "media/capture/video/linux/video_capture_device_chromeos.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void OnDisplayMetricsChanged(const gfx::Display& display, | 52 void OnDisplayMetricsChanged(const gfx::Display& display, |
| 53 uint32_t metrics) override { | 53 uint32_t metrics) override { |
| 54 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 54 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 55 if (!(metrics & DISPLAY_METRIC_ROTATION)) | 55 if (!(metrics & DISPLAY_METRIC_ROTATION)) |
| 56 return; | 56 return; |
| 57 SendDisplayRotation(display); | 57 SendDisplayRotation(display); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void AddObserverOnUIThread() { | 60 void AddObserverOnUIThread() { |
| 61 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 61 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 62 gfx::Screen* screen = | 62 gfx::Screen* screen = gfx::Screen::GetScreen(); |
| 63 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | |
| 64 if (screen) { | 63 if (screen) { |
| 65 screen->AddObserver(this); | 64 screen->AddObserver(this); |
| 66 SendDisplayRotation(screen->GetPrimaryDisplay()); | 65 SendDisplayRotation(screen->GetPrimaryDisplay()); |
| 67 } | 66 } |
| 68 } | 67 } |
| 69 | 68 |
| 70 void RemoveObserverOnUIThread() { | 69 void RemoveObserverOnUIThread() { |
| 71 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 70 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 72 gfx::Screen* screen = | 71 gfx::Screen* screen = gfx::Screen::GetScreen(); |
| 73 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | |
| 74 if (screen) | 72 if (screen) |
| 75 screen->RemoveObserver(this); | 73 screen->RemoveObserver(this); |
| 76 } | 74 } |
| 77 | 75 |
| 78 // Post the screen rotation change from the UI thread to capture thread | 76 // Post the screen rotation change from the UI thread to capture thread |
| 79 void SendDisplayRotation(const gfx::Display& display) { | 77 void SendDisplayRotation(const gfx::Display& display) { |
| 80 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 78 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 81 capture_task_runner_->PostTask( | 79 capture_task_runner_->PostTask( |
| 82 FROM_HERE, | 80 FROM_HERE, |
| 83 base::Bind(&ScreenObserverDelegate::SendDisplayRotationOnCaptureThread, | 81 base::Bind(&ScreenObserverDelegate::SendDisplayRotationOnCaptureThread, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 screen_observer_delegate_->RemoveObserver(); | 106 screen_observer_delegate_->RemoveObserver(); |
| 109 } | 107 } |
| 110 | 108 |
| 111 void VideoCaptureDeviceChromeOS::SetDisplayRotation( | 109 void VideoCaptureDeviceChromeOS::SetDisplayRotation( |
| 112 const gfx::Display& display) { | 110 const gfx::Display& display) { |
| 113 if (display.IsInternal()) | 111 if (display.IsInternal()) |
| 114 SetRotation(display.rotation() * 90); | 112 SetRotation(display.rotation() * 90); |
| 115 } | 113 } |
| 116 | 114 |
| 117 } // namespace media | 115 } // namespace media |
| OLD | NEW |