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

Unified Diff: ash/shell.cc

Issue 139053003: Chrome OS: avoid suspending on lid close when casting is active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove dependencies of chrome in chromeos. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index 532da3e7fd56a71f1e7faec89a07a28f571bab13..785bb6ff1a22c5a4e45ef754058fff1ee3cc9c09 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -583,6 +583,7 @@ Shell::Shell(ShellDelegate* delegate)
// We can't do this with a root window listener because XI_HierarchyChanged
// messages don't have a target window.
base::MessagePumpX11::Current()->AddObserver(output_configurator());
+ MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
#endif // defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
@@ -710,6 +711,7 @@ Shell::~Shell() {
base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(
output_configurator());
base::MessagePumpX11::Current()->RemoveObserver(output_configurator());
+ MediaCaptureDevicesDispatcher::GetInstance()->RemoveObserver(this);
display_change_observer_.reset();
#endif // defined(OS_CHROMEOS)
@@ -1036,4 +1038,23 @@ void Shell::OnWindowActivated(aura::Window* gained_active,
target_root_window_ = gained_active->GetRootWindow();
}
+////////////////////////////////////////////////////////////////////////////////
+// Shell, MediaCaptureDevicesDispatcher::Observer implementation:
+
+void Shell::OnRequestUpdate(int render_process_id,
+ int render_view_id,
+ const content::MediaStreamDevice& device,
+ const content::MediaRequestState state) {
+#if defined(OS_CHROMEOS) && defined(USE_X11)
+ if (device.type == content::MEDIA_TAB_VIDEO_CAPTURE ||
+ device.type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
+ if (state == content::MEDIA_REQUEST_STATE_DONE) {
+ output_configurator_->OnScreenSharingChanged(true);
+ } else if (state == content::MEDIA_REQUEST_STATE_CLOSING) {
+ output_configurator_->OnScreenSharingChanged(false);
+ }
+ }
+#endif
+}
+
} // namespace ash
« ash/DEPS ('K') | « ash/shell.h ('k') | chromeos/display/output_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698