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

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

Issue 2252783004: Implement MediaSession (metadata) per frame [NOT READY, HAS DEPENDENCY] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 4 years, 3 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 125 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
126 #include "third_party/skia/include/core/SkBitmap.h" 126 #include "third_party/skia/include/core/SkBitmap.h"
127 #include "ui/accessibility/ax_tree_combiner.h" 127 #include "ui/accessibility/ax_tree_combiner.h"
128 #include "ui/base/layout.h" 128 #include "ui/base/layout.h"
129 #include "ui/events/blink/web_input_event_traits.h" 129 #include "ui/events/blink/web_input_event_traits.h"
130 #include "ui/gl/gl_switches.h" 130 #include "ui/gl/gl_switches.h"
131 131
132 #if defined(OS_ANDROID) 132 #if defined(OS_ANDROID)
133 #include "content/browser/android/content_video_view.h" 133 #include "content/browser/android/content_video_view.h"
134 #include "content/browser/android/date_time_chooser_android.h" 134 #include "content/browser/android/date_time_chooser_android.h"
135 #include "content/browser/media/android/browser_media_session_manager.h"
135 #include "content/browser/media/android/media_web_contents_observer_android.h" 136 #include "content/browser/media/android/media_web_contents_observer_android.h"
136 #include "content/browser/web_contents/web_contents_android.h" 137 #include "content/browser/web_contents/web_contents_android.h"
137 #endif // OS_ANDROID 138 #endif // OS_ANDROID
138 139
139 #if defined(OS_MACOSX) 140 #if defined(OS_MACOSX)
140 #include "base/mac/foundation_util.h" 141 #include "base/mac/foundation_util.h"
141 #endif 142 #endif
142 143
143 #if defined(USE_AURA) 144 #if defined(USE_AURA)
144 #include "content/browser/web_contents/web_contents_view_mus.h" 145 #include "content/browser/web_contents/web_contents_view_mus.h"
(...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 static_cast<RenderViewHostImpl*>(render_view_message_source_); 3808 static_cast<RenderViewHostImpl*>(render_view_message_source_);
3808 if (!rvhi->is_active()) 3809 if (!rvhi->is_active())
3809 return; 3810 return;
3810 3811
3811 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3812 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3812 DidUpdateFaviconURL(candidates)); 3813 DidUpdateFaviconURL(candidates));
3813 } 3814 }
3814 3815
3815 void WebContentsImpl::OnMediaSessionStateChanged() { 3816 void WebContentsImpl::OnMediaSessionStateChanged() {
3816 MediaSession* session = MediaSession::Get(this); 3817 MediaSession* session = MediaSession::Get(this);
3818 base::Optional<MediaMetadata> metadata;
3819 #if defined(OS_ANDROID)
whywhat 2016/09/13 16:23:26 does it have to be android only? I thought we have
Zhiqiang Zhang (Slow) 2016/09/13 17:15:56 Yes, BrowserMediaSessionManager is in content/brow
3820 BrowserMediaSessionManager* session_manager =
3821 static_cast<MediaWebContentsObserverAndroid*>(
3822 media_web_contents_observer())
3823 ->GetMediaSessionManager(GetMainFrame());
3824 if (session_manager->media_metadata()) {
3825 metadata = *session_manager->media_metadata();
3826 }
3827 #endif // defined(OS_ANDROID)
3817 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3828 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3818 MediaSessionStateChanged(session->IsControllable(), 3829 MediaSessionStateChanged(session->IsControllable(),
3819 session->IsSuspended(), 3830 session->IsSuspended(), metadata));
3820 session->metadata()));
3821 } 3831 }
3822 3832
3823 void WebContentsImpl::ResumeMediaSession() { 3833 void WebContentsImpl::ResumeMediaSession() {
3824 MediaSession::Get(this)->Resume(MediaSession::SuspendType::UI); 3834 MediaSession::Get(this)->Resume(MediaSession::SuspendType::UI);
3825 } 3835 }
3826 3836
3827 void WebContentsImpl::SuspendMediaSession() { 3837 void WebContentsImpl::SuspendMediaSession() {
3828 MediaSession::Get(this)->Suspend(MediaSession::SuspendType::UI); 3838 MediaSession::Get(this)->Suspend(MediaSession::SuspendType::UI);
3829 } 3839 }
3830 3840
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 for (RenderViewHost* render_view_host : render_view_host_set) 5213 for (RenderViewHost* render_view_host : render_view_host_set)
5204 render_view_host->OnWebkitPreferencesChanged(); 5214 render_view_host->OnWebkitPreferencesChanged();
5205 } 5215 }
5206 5216
5207 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5217 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5208 JavaScriptDialogManager* dialog_manager) { 5218 JavaScriptDialogManager* dialog_manager) {
5209 dialog_manager_ = dialog_manager; 5219 dialog_manager_ = dialog_manager;
5210 } 5220 }
5211 5221
5212 } // namespace content 5222 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698