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

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

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: addressed comments Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_android.h" 5 #include "content/browser/web_contents/web_contents_android.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "content/browser/accessibility/browser_accessibility_android.h" 17 #include "content/browser/accessibility/browser_accessibility_android.h"
18 #include "content/browser/accessibility/browser_accessibility_manager_android.h" 18 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
19 #include "content/browser/android/content_view_core_impl.h" 19 #include "content/browser/android/content_view_core_impl.h"
20 #include "content/browser/android/interstitial_page_delegate_android.h" 20 #include "content/browser/android/interstitial_page_delegate_android.h"
21 #include "content/browser/frame_host/interstitial_page_impl.h" 21 #include "content/browser/frame_host/interstitial_page_impl.h"
22 #include "content/browser/media/android/browser_media_player_manager.h" 22 #include "content/browser/media/android/browser_media_player_manager.h"
23 #include "content/browser/media/android/media_web_contents_observer_android.h" 23 #include "content/browser/media/android/media_web_contents_observer_android.h"
24 #include "content/browser/media/session/media_session.h"
25 #include "content/browser/media/session/media_session_delegate_android.h"
24 #include "content/browser/renderer_host/render_view_host_impl.h" 26 #include "content/browser/renderer_host/render_view_host_impl.h"
25 #include "content/browser/web_contents/web_contents_impl.h" 27 #include "content/browser/web_contents/web_contents_impl.h"
26 #include "content/common/devtools_messages.h" 28 #include "content/common/devtools_messages.h"
27 #include "content/common/frame_messages.h" 29 #include "content/common/frame_messages.h"
28 #include "content/common/input_messages.h" 30 #include "content/common/input_messages.h"
29 #include "content/common/view_messages.h" 31 #include "content/common/view_messages.h"
30 #include "content/public/browser/android/app_web_message_port_service.h" 32 #include "content/public/browser/android/app_web_message_port_service.h"
31 #include "content/public/browser/browser_context.h" 33 #include "content/public/browser/browser_context.h"
32 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/message_port_provider.h" 35 #include "content/public/browser/message_port_provider.h"
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // base::Callback. 608 // base::Callback.
607 ScopedJavaGlobalRef<jobject> j_callback; 609 ScopedJavaGlobalRef<jobject> j_callback;
608 j_callback.Reset(env, callback); 610 j_callback.Reset(env, callback);
609 611
610 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = 612 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback =
611 base::Bind(&AXTreeSnapshotCallback, j_callback); 613 base::Bind(&AXTreeSnapshotCallback, j_callback);
612 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( 614 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot(
613 snapshot_callback); 615 snapshot_callback);
614 } 616 }
615 617
616 void WebContentsAndroid::ResumeMediaSession(JNIEnv* env, 618 void WebContentsAndroid::AddMediaSessionDelegate(
whywhat 2016/10/21 18:28:15 When is the delegate going to be removed? Do you t
617 const JavaParamRef<jobject>& obj) { 619 JNIEnv* env,
618 web_contents_->ResumeMediaSession(); 620 const JavaParamRef<jobject>& obj,
619 } 621 const JavaParamRef<jobject>& j_delegate) {
620 622 MediaSessionDelegateAndroid::CreateAndConnect(
621 void WebContentsAndroid::SuspendMediaSession(JNIEnv* env, 623 MediaSession::Get(web_contents()), env, j_delegate);
622 const JavaParamRef<jobject>& obj) {
623 web_contents_->SuspendMediaSession();
624 }
625
626 void WebContentsAndroid::StopMediaSession(JNIEnv* env,
627 const JavaParamRef<jobject>& obj) {
628 web_contents_->StopMediaSession();
629 } 624 }
630 625
631 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( 626 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding(
632 JNIEnv* env, 627 JNIEnv* env,
633 const JavaParamRef<jobject>& obj) const { 628 const JavaParamRef<jobject>& obj) const {
634 return base::android::ConvertUTF8ToJavaString(env, 629 return base::android::ConvertUTF8ToJavaString(env,
635 web_contents_->GetEncoding()); 630 web_contents_->GetEncoding());
636 } 631 }
637 632
638 void WebContentsAndroid::GetContentBitmap( 633 void WebContentsAndroid::GetContentBitmap(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap); 722 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap);
728 } 723 }
729 for (const gfx::Size& size : sizes) { 724 for (const gfx::Size& size : sizes) {
730 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(), 725 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(),
731 size.height()); 726 size.height());
732 } 727 }
733 Java_WebContentsImpl_onDownloadImageFinished( 728 Java_WebContentsImpl_onDownloadImageFinished(
734 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes); 729 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes);
735 } 730 }
736 } // namespace content 731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698