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

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: 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(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
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/gfx/display_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698