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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1698933004: Make MediaSession a runtime-enabled feature on Desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with flag Created 4 years, 10 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 (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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/browser/frame_host/navigator_impl.h" 46 #include "content/browser/frame_host/navigator_impl.h"
47 #include "content/browser/frame_host/render_frame_host_impl.h" 47 #include "content/browser/frame_host/render_frame_host_impl.h"
48 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 48 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
49 #include "content/browser/geolocation/geolocation_service_context.h" 49 #include "content/browser/geolocation/geolocation_service_context.h"
50 #include "content/browser/host_zoom_map_impl.h" 50 #include "content/browser/host_zoom_map_impl.h"
51 #include "content/browser/loader/resource_dispatcher_host_impl.h" 51 #include "content/browser/loader/resource_dispatcher_host_impl.h"
52 #include "content/browser/manifest/manifest_manager_host.h" 52 #include "content/browser/manifest/manifest_manager_host.h"
53 #include "content/browser/media/audio_stream_monitor.h" 53 #include "content/browser/media/audio_stream_monitor.h"
54 #include "content/browser/media/capture/web_contents_audio_muter.h" 54 #include "content/browser/media/capture/web_contents_audio_muter.h"
55 #include "content/browser/media/media_web_contents_observer.h" 55 #include "content/browser/media/media_web_contents_observer.h"
56 #include "content/browser/media/session/media_session.h"
56 #include "content/browser/message_port_message_filter.h" 57 #include "content/browser/message_port_message_filter.h"
57 #include "content/browser/plugin_content_origin_whitelist.h" 58 #include "content/browser/plugin_content_origin_whitelist.h"
58 #include "content/browser/renderer_host/render_process_host_impl.h" 59 #include "content/browser/renderer_host/render_process_host_impl.h"
59 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 60 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
60 #include "content/browser/renderer_host/render_view_host_impl.h" 61 #include "content/browser/renderer_host/render_view_host_impl.h"
61 #include "content/browser/renderer_host/render_widget_host_impl.h" 62 #include "content/browser/renderer_host/render_widget_host_impl.h"
62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" 63 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
63 #include "content/browser/renderer_host/render_widget_host_view_base.h" 64 #include "content/browser/renderer_host/render_widget_host_view_base.h"
64 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" 65 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h"
65 #include "content/browser/site_instance_impl.h" 66 #include "content/browser/site_instance_impl.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 118 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
118 #include "third_party/skia/include/core/SkBitmap.h" 119 #include "third_party/skia/include/core/SkBitmap.h"
119 #include "ui/base/layout.h" 120 #include "ui/base/layout.h"
120 #include "ui/gfx/display.h" 121 #include "ui/gfx/display.h"
121 #include "ui/gfx/screen.h" 122 #include "ui/gfx/screen.h"
122 #include "ui/gl/gl_switches.h" 123 #include "ui/gl/gl_switches.h"
123 124
124 #if defined(OS_ANDROID) 125 #if defined(OS_ANDROID)
125 #include "content/browser/android/content_video_view.h" 126 #include "content/browser/android/content_video_view.h"
126 #include "content/browser/android/date_time_chooser_android.h" 127 #include "content/browser/android/date_time_chooser_android.h"
127 #include "content/browser/media/android/media_session.h"
128 #include "content/browser/media/android/media_web_contents_observer_android.h" 128 #include "content/browser/media/android/media_web_contents_observer_android.h"
129 #include "content/browser/web_contents/web_contents_android.h" 129 #include "content/browser/web_contents/web_contents_android.h"
130 #endif // OS_ANDROID 130 #endif // OS_ANDROID
131 131
132 #if defined(OS_MACOSX) 132 #if defined(OS_MACOSX)
133 #include "base/mac/foundation_util.h" 133 #include "base/mac/foundation_util.h"
134 #endif 134 #endif
135 135
136 #if defined(MOJO_SHELL_CLIENT) 136 #if defined(MOJO_SHELL_CLIENT)
137 #include "content/browser/web_contents/web_contents_view_mus.h" 137 #include "content/browser/web_contents/web_contents_view_mus.h"
(...skipping 3371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3509 // for the new page has committed. 3509 // for the new page has committed.
3510 RenderViewHostImpl* rvhi = 3510 RenderViewHostImpl* rvhi =
3511 static_cast<RenderViewHostImpl*>(render_view_message_source_); 3511 static_cast<RenderViewHostImpl*>(render_view_message_source_);
3512 if (!rvhi->is_active()) 3512 if (!rvhi->is_active())
3513 return; 3513 return;
3514 3514
3515 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3515 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3516 DidUpdateFaviconURL(candidates)); 3516 DidUpdateFaviconURL(candidates));
3517 } 3517 }
3518 3518
3519 #if defined(OS_ANDROID)
3520
3521 void WebContentsImpl::OnMediaSessionStateChanged() { 3519 void WebContentsImpl::OnMediaSessionStateChanged() {
3522 MediaSession* session = MediaSession::Get(this); 3520 MediaSession* session = MediaSession::Get(this);
3523 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3521 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3524 MediaSessionStateChanged(session->IsControllable(), 3522 MediaSessionStateChanged(session->IsControllable(),
3525 session->IsSuspended())); 3523 session->IsSuspended()));
3526 } 3524 }
3527 3525
3528 void WebContentsImpl::ResumeMediaSession() { 3526 void WebContentsImpl::ResumeMediaSession() {
3529 MediaSession::Get(this)->Resume(); 3527 MediaSession::Get(this)->Resume(MediaSession::SuspendType::UI);
3530 } 3528 }
3531 3529
3532 void WebContentsImpl::SuspendMediaSession() { 3530 void WebContentsImpl::SuspendMediaSession() {
3533 MediaSession::Get(this)->Suspend(); 3531 MediaSession::Get(this)->Suspend(MediaSession::SuspendType::UI);
3534 } 3532 }
3535 3533
3536 void WebContentsImpl::StopMediaSession() { 3534 void WebContentsImpl::StopMediaSession() {
3537 MediaSession::Get(this)->Stop(); 3535 MediaSession::Get(this)->Stop(MediaSession::SuspendType::UI);
3538 } 3536 }
3539 3537
3540 #endif // defined(OS_ANDROID)
3541
3542 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { 3538 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() {
3543 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3539 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3544 DidFirstVisuallyNonEmptyPaint()); 3540 DidFirstVisuallyNonEmptyPaint());
3545 3541
3546 did_first_visually_non_empty_paint_ = true; 3542 did_first_visually_non_empty_paint_ = true;
3547 3543
3548 if (theme_color_ != last_sent_theme_color_) { 3544 if (theme_color_ != last_sent_theme_color_) {
3549 // Theme color should have updated by now if there was one. 3545 // Theme color should have updated by now if there was one.
3550 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3546 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3551 DidChangeThemeColor(theme_color_)); 3547 DidChangeThemeColor(theme_color_));
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 const WebContentsObserver::MediaPlayerId& id) { 4757 const WebContentsObserver::MediaPlayerId& id) {
4762 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4758 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4763 } 4759 }
4764 4760
4765 void WebContentsImpl::MediaStoppedPlaying( 4761 void WebContentsImpl::MediaStoppedPlaying(
4766 const WebContentsObserver::MediaPlayerId& id) { 4762 const WebContentsObserver::MediaPlayerId& id) {
4767 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4763 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4768 } 4764 }
4769 4765
4770 } // namespace content 4766 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698