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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 2640023008: Enabling autoplay and fullscreen for downloaded media (Closed)
Patch Set: dtrainor@ comments Created 3 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
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "content/public/browser/interstitial_page.h" 66 #include "content/public/browser/interstitial_page.h"
67 #include "content/public/browser/navigation_entry.h" 67 #include "content/public/browser/navigation_entry.h"
68 #include "content/public/browser/notification_service.h" 68 #include "content/public/browser/notification_service.h"
69 #include "content/public/browser/render_frame_host.h" 69 #include "content/public/browser/render_frame_host.h"
70 #include "content/public/browser/render_process_host.h" 70 #include "content/public/browser/render_process_host.h"
71 #include "content/public/browser/render_view_host.h" 71 #include "content/public/browser/render_view_host.h"
72 #include "content/public/browser/user_metrics.h" 72 #include "content/public/browser/user_metrics.h"
73 #include "content/public/browser/web_contents.h" 73 #include "content/public/browser/web_contents.h"
74 #include "content/public/common/browser_controls_state.h" 74 #include "content/public/common/browser_controls_state.h"
75 #include "content/public/common/resource_request_body.h" 75 #include "content/public/common/resource_request_body.h"
76 #include "content/public/common/web_preferences.h"
76 #include "jni/Tab_jni.h" 77 #include "jni/Tab_jni.h"
77 #include "net/base/escape.h" 78 #include "net/base/escape.h"
78 #include "skia/ext/image_operations.h" 79 #include "skia/ext/image_operations.h"
79 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 80 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
80 #include "ui/android/view_android.h" 81 #include "ui/android/view_android.h"
81 #include "ui/android/window_android.h" 82 #include "ui/android/window_android.h"
82 #include "ui/base/resource/resource_bundle.h" 83 #include "ui/base/resource/resource_bundle.h"
83 #include "ui/base/window_open_disposition.h" 84 #include "ui/base/window_open_disposition.h"
84 #include "ui/display/display.h" 85 #include "ui/display/display.h"
85 #include "ui/display/screen.h" 86 #include "ui/display/screen.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void TabAndroid::AttachTabHelpers(content::WebContents* web_contents) { 120 void TabAndroid::AttachTabHelpers(content::WebContents* web_contents) {
120 DCHECK(web_contents); 121 DCHECK(web_contents);
121 122
122 TabHelpers::AttachTabHelpers(web_contents); 123 TabHelpers::AttachTabHelpers(web_contents);
123 } 124 }
124 125
125 TabAndroid::TabAndroid(JNIEnv* env, const JavaRef<jobject>& obj) 126 TabAndroid::TabAndroid(JNIEnv* env, const JavaRef<jobject>& obj)
126 : weak_java_tab_(env, obj), 127 : weak_java_tab_(env, obj),
127 content_layer_(cc::Layer::Create()), 128 content_layer_(cc::Layer::Create()),
128 tab_content_manager_(NULL), 129 tab_content_manager_(NULL),
129 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) { 130 synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)),
131 embedded_media_experience_enabled_(false) {
130 Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this)); 132 Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this));
131 } 133 }
132 134
133 TabAndroid::~TabAndroid() { 135 TabAndroid::~TabAndroid() {
134 GetContentLayer()->RemoveAllChildren(); 136 GetContentLayer()->RemoveAllChildren();
135 JNIEnv* env = base::android::AttachCurrentThread(); 137 JNIEnv* env = base::android::AttachCurrentThread();
136 Java_Tab_clearNativePtr(env, weak_java_tab_.get(env)); 138 Java_Tab_clearNativePtr(env, weak_java_tab_.get(env));
137 } 139 }
138 140
139 base::android::ScopedJavaLocalRef<jobject> TabAndroid::GetJavaObject() { 141 base::android::ScopedJavaLocalRef<jobject> TabAndroid::GetJavaObject() {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 env, *offline_page); 711 env, *offline_page);
710 } 712 }
711 713
712 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, 714 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env,
713 const JavaParamRef<jobject>& obj, 715 const JavaParamRef<jobject>& obj,
714 const JavaParamRef<jstring>& url) { 716 const JavaParamRef<jstring>& url) {
715 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); 717 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url));
716 return HasPrerenderedUrl(gurl); 718 return HasPrerenderedUrl(gurl);
717 } 719 }
718 720
721 void TabAndroid::EnableEmbeddedMediaExperience(
722 JNIEnv* env,
723 const base::android::JavaParamRef<jobject>& obj,
724 jboolean enabled) {
725 embedded_media_experience_enabled_ = enabled;
726
727 if (!web_contents() || !web_contents()->GetRenderViewHost())
728 return;
729
730 web_contents()->GetRenderViewHost()->OnWebkitPreferencesChanged();
731 }
732
733 bool TabAndroid::ShouldEnableEmbeddedMediaExperience() const {
734 return embedded_media_experience_enabled_;
David Trainor- moved to gerrit 2017/02/23 21:15:25 Had a talk offline. Follow up is maybe we can che
shaktisahu 2017/02/23 22:43:27 Actually I checked this. We can't add that check h
735 }
736
719 namespace { 737 namespace {
720 738
721 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate { 739 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate {
722 public: 740 public:
723 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate) 741 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate)
724 : InterceptNavigationDelegate(env, jdelegate) {} 742 : InterceptNavigationDelegate(env, jdelegate) {}
725 743
726 bool ShouldIgnoreNavigation( 744 bool ShouldIgnoreNavigation(
727 const NavigationParams& navigation_params) override { 745 const NavigationParams& navigation_params) override {
728 NavigationParams chrome_navigation_params(navigation_params); 746 NavigationParams chrome_navigation_params(navigation_params);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 793 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
776 TRACE_EVENT0("native", "TabAndroid::Init"); 794 TRACE_EVENT0("native", "TabAndroid::Init");
777 // This will automatically bind to the Java object and pass ownership there. 795 // This will automatically bind to the Java object and pass ownership there.
778 new TabAndroid(env, obj); 796 new TabAndroid(env, obj);
779 } 797 }
780 798
781 // static 799 // static
782 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 800 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
783 return RegisterNativesImpl(env); 801 return RegisterNativesImpl(env);
784 } 802 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698