| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromecast/browser/cast_media_blocker.h" | 5 #include "chromecast/browser/cast_media_blocker.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_checker.h" | 7 #include "base/threading/thread_checker.h" |
| 8 #include "content/public/browser/media_session.h" | 8 #include "content/public/browser/media_session.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| 11 namespace chromecast { | 11 namespace chromecast { |
| 12 namespace shell { | 12 namespace shell { |
| 13 | 13 |
| 14 CastMediaBlocker::CastMediaBlocker(content::MediaSession* media_session, | 14 CastMediaBlocker::CastMediaBlocker(content::MediaSession* media_session) |
| 15 content::WebContents* web_contents) | |
| 16 : content::MediaSessionObserver(media_session), | 15 : content::MediaSessionObserver(media_session), |
| 17 content::WebContentsObserver(web_contents), | |
| 18 blocked_(false), | 16 blocked_(false), |
| 19 paused_by_user_(true), | 17 paused_by_user_(true), |
| 20 suspended_(true), | 18 suspended_(true), |
| 21 controllable_(false) {} | 19 controllable_(false) {} |
| 22 | 20 |
| 23 CastMediaBlocker::~CastMediaBlocker() {} | 21 CastMediaBlocker::~CastMediaBlocker() {} |
| 24 | 22 |
| 25 void CastMediaBlocker::BlockMediaLoading(bool blocked) { | 23 void CastMediaBlocker::BlockMediaLoading(bool blocked) { |
| 26 if (blocked_ == blocked) | 24 if (blocked_ == blocked) |
| 27 return; | 25 return; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void CastMediaBlocker::Resume() { | 101 void CastMediaBlocker::Resume() { |
| 104 if (!media_session()) | 102 if (!media_session()) |
| 105 return; | 103 return; |
| 106 | 104 |
| 107 LOG(INFO) << "Resuming media session."; | 105 LOG(INFO) << "Resuming media session."; |
| 108 media_session()->Resume(content::MediaSession::SuspendType::SYSTEM); | 106 media_session()->Resume(content::MediaSession::SuspendType::SYSTEM); |
| 109 } | 107 } |
| 110 | 108 |
| 111 } // namespace shell | 109 } // namespace shell |
| 112 } // namespace chromecast | 110 } // namespace chromecast |
| OLD | NEW |