Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: media/video/capture/linux/video_capture_device_chromeos.cc

Issue 259253002: Add OnDisplayMetricsChanged in DisplayObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_orientation
Patch Set: oshima review comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
51 const gfx::Display& display,
52 gfx::DisplayObserver::DisplayMetrics metrics) OVERRIDE {
53 if (!(metrics & DISPLAY_METRIC_ROTATION))
54 return;
55 SendDisplayRotation(display);
56 }
55 57
56 void AddObserverOnUIThread() { 58 void AddObserverOnUIThread() {
57 DCHECK(ui_task_runner_->BelongsToCurrentThread()); 59 DCHECK(ui_task_runner_->BelongsToCurrentThread());
58 gfx::Screen* screen = 60 gfx::Screen* screen =
59 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); 61 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
60 if (screen) { 62 if (screen) {
61 screen->AddObserver(this); 63 screen->AddObserver(this);
62 SendDisplayRotation(screen->GetPrimaryDisplay()); 64 SendDisplayRotation(screen->GetPrimaryDisplay());
63 } 65 }
64 } 66 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 screen_observer_delegate_->RemoveObserver(); 105 screen_observer_delegate_->RemoveObserver();
104 } 106 }
105 107
106 void VideoCaptureDeviceChromeOS::SetDisplayRotation( 108 void VideoCaptureDeviceChromeOS::SetDisplayRotation(
107 const gfx::Display& display) { 109 const gfx::Display& display) {
108 if (display.IsInternal()) 110 if (display.IsInternal())
109 SetRotation(display.rotation() * 90); 111 SetRotation(display.rotation() * 90);
110 } 112 }
111 113
112 } // namespace media 114 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698