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/video/capture/linux/video_capture_device_chromeos.h" | 5 #include "media/video/capture/linux/video_capture_device_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 base::Bind(&ScreenObserverDelegate::RemoveObserverOnUIThread, this)); | 38 base::Bind(&ScreenObserverDelegate::RemoveObserverOnUIThread, this)); |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 friend class base::RefCountedThreadSafe<ScreenObserverDelegate>; | 42 friend class base::RefCountedThreadSafe<ScreenObserverDelegate>; |
43 | 43 |
44 virtual ~ScreenObserverDelegate() { | 44 virtual ~ScreenObserverDelegate() { |
45 DCHECK(!capture_device_); | 45 DCHECK(!capture_device_); |
46 } | 46 } |
47 | 47 |
48 // gfx::DisplayObserver: | |
49 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE { | |
50 SendDisplayRotation(display); | |
51 } | |
52 | |
53 virtual void OnDisplayAdded(const gfx::Display& /*new_display*/) OVERRIDE {} | 48 virtual void OnDisplayAdded(const gfx::Display& /*new_display*/) OVERRIDE {} |
54 virtual void OnDisplayRemoved(const gfx::Display& /*old_display*/) OVERRIDE {} | 49 virtual void OnDisplayRemoved(const gfx::Display& /*old_display*/) OVERRIDE {} |
| 50 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 51 uint32_t metrics) OVERRIDE { |
| 52 if (!(metrics & DISPLAY_METRIC_ROTATION)) |
| 53 return; |
| 54 SendDisplayRotation(display); |
| 55 } |
55 | 56 |
56 void AddObserverOnUIThread() { | 57 void AddObserverOnUIThread() { |
57 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 58 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
58 gfx::Screen* screen = | 59 gfx::Screen* screen = |
59 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | 60 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); |
60 if (screen) { | 61 if (screen) { |
61 screen->AddObserver(this); | 62 screen->AddObserver(this); |
62 SendDisplayRotation(screen->GetPrimaryDisplay()); | 63 SendDisplayRotation(screen->GetPrimaryDisplay()); |
63 } | 64 } |
64 } | 65 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 screen_observer_delegate_->RemoveObserver(); | 104 screen_observer_delegate_->RemoveObserver(); |
104 } | 105 } |
105 | 106 |
106 void VideoCaptureDeviceChromeOS::SetDisplayRotation( | 107 void VideoCaptureDeviceChromeOS::SetDisplayRotation( |
107 const gfx::Display& display) { | 108 const gfx::Display& display) { |
108 if (display.IsInternal()) | 109 if (display.IsInternal()) |
109 SetRotation(display.rotation() * 90); | 110 SetRotation(display.rotation() * 90); |
110 } | 111 } |
111 | 112 |
112 } // namespace media | 113 } // namespace media |
OLD | NEW |