OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #include "ui/gl/gl_switches.h" | 111 #include "ui/gl/gl_switches.h" |
112 | 112 |
113 #if defined(ENABLE_BROWSER_CDMS) | 113 #if defined(ENABLE_BROWSER_CDMS) |
114 #include "content/browser/media/media_web_contents_observer.h" | 114 #include "content/browser/media/media_web_contents_observer.h" |
115 #endif | 115 #endif |
116 | 116 |
117 #if defined(OS_ANDROID) | 117 #if defined(OS_ANDROID) |
118 #include "content/browser/android/content_video_view.h" | 118 #include "content/browser/android/content_video_view.h" |
119 #include "content/browser/android/date_time_chooser_android.h" | 119 #include "content/browser/android/date_time_chooser_android.h" |
120 #include "content/browser/android/media_players_observer.h" | 120 #include "content/browser/android/media_players_observer.h" |
| 121 #include "content/browser/media/android/media_session.h" |
121 #include "content/browser/web_contents/web_contents_android.h" | 122 #include "content/browser/web_contents/web_contents_android.h" |
122 #endif | 123 #endif |
123 | 124 |
124 #if defined(OS_MACOSX) | 125 #if defined(OS_MACOSX) |
125 #include "base/mac/foundation_util.h" | 126 #include "base/mac/foundation_util.h" |
126 #endif | 127 #endif |
127 | 128 |
128 namespace content { | 129 namespace content { |
129 namespace { | 130 namespace { |
130 | 131 |
(...skipping 3138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 } | 3270 } |
3270 | 3271 |
3271 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) { | 3272 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) { |
3272 RemoveMediaPlayerEntry(player_cookie, &active_audio_players_); | 3273 RemoveMediaPlayerEntry(player_cookie, &active_audio_players_); |
3273 RemoveMediaPlayerEntry(player_cookie, &active_video_players_); | 3274 RemoveMediaPlayerEntry(player_cookie, &active_video_players_); |
3274 MaybeReleasePowerSaveBlockers(); | 3275 MaybeReleasePowerSaveBlockers(); |
3275 | 3276 |
3276 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaPaused()); | 3277 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaPaused()); |
3277 } | 3278 } |
3278 | 3279 |
| 3280 #if defined(OS_ANDROID) |
| 3281 |
| 3282 void WebContentsImpl::OnMediaSessionStateChanged() { |
| 3283 MediaSession* session = MediaSession::Get(this); |
| 3284 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3285 MediaSessionStateChanged(session->IsControllable(), |
| 3286 session->IsSuspended())); |
| 3287 } |
| 3288 |
| 3289 void WebContentsImpl::ResumeMediaSession() { |
| 3290 MediaSession::Get(this)->Resume(); |
| 3291 } |
| 3292 |
| 3293 void WebContentsImpl::SuspendMediaSession() { |
| 3294 MediaSession::Get(this)->Suspend(); |
| 3295 } |
| 3296 |
| 3297 #endif // defined(OS_ANDROID) |
| 3298 |
3279 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { | 3299 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { |
3280 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3300 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3281 DidFirstVisuallyNonEmptyPaint()); | 3301 DidFirstVisuallyNonEmptyPaint()); |
3282 | 3302 |
3283 did_first_visually_non_empty_paint_ = true; | 3303 did_first_visually_non_empty_paint_ = true; |
3284 | 3304 |
3285 if (theme_color_ != last_sent_theme_color_) { | 3305 if (theme_color_ != last_sent_theme_color_) { |
3286 // Theme color should have updated by now if there was one. | 3306 // Theme color should have updated by now if there was one. |
3287 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3307 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3288 DidChangeThemeColor(theme_color_)); | 3308 DidChangeThemeColor(theme_color_)); |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4476 player_map->erase(it); | 4496 player_map->erase(it); |
4477 } | 4497 } |
4478 | 4498 |
4479 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4499 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4480 force_disable_overscroll_content_ = force_disable; | 4500 force_disable_overscroll_content_ = force_disable; |
4481 if (view_) | 4501 if (view_) |
4482 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4502 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4483 } | 4503 } |
4484 | 4504 |
4485 } // namespace content | 4505 } // namespace content |
OLD | NEW |