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

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

Issue 2640023008: Enabling autoplay and fullscreen for downloaded media (Closed)
Patch Set: Changed to override pref from ContentBrowserClient 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
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 env, *offline_page); 710 env, *offline_page);
710 } 711 }
711 712
712 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, 713 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env,
713 const JavaParamRef<jobject>& obj, 714 const JavaParamRef<jobject>& obj,
714 const JavaParamRef<jstring>& url) { 715 const JavaParamRef<jstring>& url) {
715 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); 716 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url));
716 return HasPrerenderedUrl(gurl); 717 return HasPrerenderedUrl(gurl);
717 } 718 }
718 719
720 void TabAndroid::EnableEmbeddedMediaExperience(
721 JNIEnv* env,
722 const base::android::JavaParamRef<jobject>& obj,
723 jboolean enabled) {
724 embedded_media_experience_enabled_ = enabled;
725
726 if (!web_contents() || !web_contents()->GetRenderViewHost())
727 return;
728
729 web_contents()->GetRenderViewHost()->OnWebkitPreferencesChanged();
730 }
731
732 bool TabAndroid::ShouldEnableEmbeddedMediaExperience() {
733 return embedded_media_experience_enabled_;
734 }
735
719 namespace { 736 namespace {
720 737
721 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate { 738 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate {
722 public: 739 public:
723 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate) 740 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate)
724 : InterceptNavigationDelegate(env, jdelegate) {} 741 : InterceptNavigationDelegate(env, jdelegate) {}
725 742
726 bool ShouldIgnoreNavigation( 743 bool ShouldIgnoreNavigation(
727 const NavigationParams& navigation_params) override { 744 const NavigationParams& navigation_params) override {
728 NavigationParams chrome_navigation_params(navigation_params); 745 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) { 792 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
776 TRACE_EVENT0("native", "TabAndroid::Init"); 793 TRACE_EVENT0("native", "TabAndroid::Init");
777 // This will automatically bind to the Java object and pass ownership there. 794 // This will automatically bind to the Java object and pass ownership there.
778 new TabAndroid(env, obj); 795 new TabAndroid(env, obj);
779 } 796 }
780 797
781 // static 798 // static
782 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 799 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
783 return RegisterNativesImpl(env); 800 return RegisterNativesImpl(env);
784 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698