Chromium Code Reviews| 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 void WebContentsImpl::OnMediaSessionStateChanged() { | |
| 3281 #if defined(OS_ANDROID) | |
|
Ted C
2015/07/06 22:18:29
shouldn't all of these be ifdef'd android if they
| |
| 3282 MediaSession* session = MediaSession::Get(this); | |
| 3283 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 3284 MediaSessionStateChanged(session->IsControllable(), | |
| 3285 session->IsSuspended())); | |
| 3286 #else | |
| 3287 NOTIMPLEMENTED(); | |
| 3288 #endif | |
| 3289 } | |
| 3290 | |
| 3291 void WebContentsImpl::ResumeMediaSession() { | |
| 3292 #if defined(OS_ANDROID) | |
| 3293 MediaSession::Get(this)->Resume(); | |
| 3294 #else | |
| 3295 NOTIMPLEMENTED(); | |
| 3296 #endif | |
| 3297 } | |
| 3298 | |
| 3299 void WebContentsImpl::SuspendMediaSession() { | |
| 3300 #if defined(OS_ANDROID) | |
| 3301 MediaSession::Get(this)->Suspend(); | |
| 3302 #else | |
| 3303 NOTIMPLEMENTED(); | |
| 3304 #endif | |
| 3305 } | |
| 3306 | |
| 3279 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { | 3307 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { |
| 3280 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3308 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3281 DidFirstVisuallyNonEmptyPaint()); | 3309 DidFirstVisuallyNonEmptyPaint()); |
| 3282 | 3310 |
| 3283 did_first_visually_non_empty_paint_ = true; | 3311 did_first_visually_non_empty_paint_ = true; |
| 3284 | 3312 |
| 3285 if (theme_color_ != last_sent_theme_color_) { | 3313 if (theme_color_ != last_sent_theme_color_) { |
| 3286 // Theme color should have updated by now if there was one. | 3314 // Theme color should have updated by now if there was one. |
| 3287 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3315 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3288 DidChangeThemeColor(theme_color_)); | 3316 DidChangeThemeColor(theme_color_)); |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4476 player_map->erase(it); | 4504 player_map->erase(it); |
| 4477 } | 4505 } |
| 4478 | 4506 |
| 4479 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4507 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4480 force_disable_overscroll_content_ = force_disable; | 4508 force_disable_overscroll_content_ = force_disable; |
| 4481 if (view_) | 4509 if (view_) |
| 4482 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4510 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4483 } | 4511 } |
| 4484 | 4512 |
| 4485 } // namespace content | 4513 } // namespace content |
| OLD | NEW |