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

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: review comments and windows build fix 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 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after
3527 // for the new page has committed. 3527 // for the new page has committed.
3528 RenderViewHostImpl* rvhi = 3528 RenderViewHostImpl* rvhi =
3529 static_cast<RenderViewHostImpl*>(render_view_message_source_); 3529 static_cast<RenderViewHostImpl*>(render_view_message_source_);
3530 if (!rvhi->is_active()) 3530 if (!rvhi->is_active())
3531 return; 3531 return;
3532 3532
3533 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3533 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3534 DidUpdateFaviconURL(candidates)); 3534 DidUpdateFaviconURL(candidates));
3535 } 3535 }
3536 3536
3537 #if defined(OS_ANDROID)
3538
3539 void WebContentsImpl::OnMediaSessionStateChanged() { 3537 void WebContentsImpl::OnMediaSessionStateChanged() {
3540 MediaSession* session = MediaSession::Get(this); 3538 MediaSession* session = MediaSession::Get(this);
3541 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3539 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3542 MediaSessionStateChanged(session->IsControllable(), 3540 MediaSessionStateChanged(session->IsControllable(),
3543 session->IsSuspended())); 3541 session->IsSuspended()));
3544 } 3542 }
3545 3543
3546 void WebContentsImpl::ResumeMediaSession() { 3544 void WebContentsImpl::ResumeMediaSession() {
3547 MediaSession::Get(this)->Resume(); 3545 MediaSession::Get(this)->Resume(MediaSession::SuspendType::UI);
3548 } 3546 }
3549 3547
3550 void WebContentsImpl::SuspendMediaSession() { 3548 void WebContentsImpl::SuspendMediaSession() {
3551 MediaSession::Get(this)->Suspend(); 3549 MediaSession::Get(this)->Suspend(MediaSession::SuspendType::UI);
3552 } 3550 }
3553 3551
3554 void WebContentsImpl::StopMediaSession() { 3552 void WebContentsImpl::StopMediaSession() {
3555 MediaSession::Get(this)->Stop(); 3553 MediaSession::Get(this)->Stop(MediaSession::SuspendType::UI);
3556 } 3554 }
3557 3555
3558 #endif // defined(OS_ANDROID)
3559
3560 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { 3556 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() {
3561 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3557 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3562 DidFirstVisuallyNonEmptyPaint()); 3558 DidFirstVisuallyNonEmptyPaint());
3563 3559
3564 did_first_visually_non_empty_paint_ = true; 3560 did_first_visually_non_empty_paint_ = true;
3565 3561
3566 if (theme_color_ != last_sent_theme_color_) { 3562 if (theme_color_ != last_sent_theme_color_) {
3567 // Theme color should have updated by now if there was one. 3563 // Theme color should have updated by now if there was one.
3568 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3564 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3569 DidChangeThemeColor(theme_color_)); 3565 DidChangeThemeColor(theme_color_));
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 const WebContentsObserver::MediaPlayerId& id) { 4782 const WebContentsObserver::MediaPlayerId& id) {
4787 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4783 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4788 } 4784 }
4789 4785
4790 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4786 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4791 JavaScriptDialogManager* dialog_manager) { 4787 JavaScriptDialogManager* dialog_manager) {
4792 dialog_manager_ = dialog_manager; 4788 dialog_manager_ = dialog_manager;
4793 } 4789 }
4794 4790
4795 } // namespace content 4791 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698