OLD | NEW |
---|---|
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 "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 } | 322 } |
323 | 323 |
324 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { | 324 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { |
325 Show(); | 325 Show(); |
326 } | 326 } |
327 | 327 |
328 void ContentViewCoreImpl::Show() { | 328 void ContentViewCoreImpl::Show() { |
329 GetWebContents()->WasShown(); | 329 GetWebContents()->WasShown(); |
330 } | 330 } |
331 | 331 |
332 void ContentViewCoreImpl::SetMediaAutoplayEnabled(JNIEnv* env, jobject obj, | |
333 jboolean is_enabled) { | |
Ted C
2013/12/10 22:58:20
if they don't all fit on the first line in C++, ea
apiccion
2013/12/13 06:09:12
Done. Thank you!
| |
334 SetMediaAutoplayEnabled(is_enabled); | |
335 } | |
336 | |
337 void ContentViewCoreImpl::SetMediaAutoplayEnabled(bool is_enabled) { | |
Ted C
2013/12/10 22:58:20
do you need this to be callable from native?
If n
apiccion
2013/12/13 06:09:12
Done.
| |
338 if (is_enabled == is_media_autoplay_enabled_) return; | |
Ted C
2013/12/10 22:58:20
The "return;" needs to go on the following line w/
apiccion
2013/12/13 06:09:12
Done.
| |
339 is_media_autoplay_enabled_ = is_enabled; | |
340 RenderViewHost* host = web_contents_->GetRenderViewHost(); | |
341 WebPreferences prefs = host->GetWebkitPreferences(); | |
342 prefs.user_gesture_required_for_media_playback = !is_enabled; | |
343 host->UpdateWebkitPreferences(prefs); | |
Ted C
2013/12/10 22:58:20
Actually, I just checked out RenderViewHostImpl::G
apiccion
2013/12/13 06:09:12
It only triggers on browser context navigation. So
| |
344 } | |
345 | |
332 void ContentViewCoreImpl::Hide() { | 346 void ContentViewCoreImpl::Hide() { |
333 GetWebContents()->WasHidden(); | 347 GetWebContents()->WasHidden(); |
334 PauseVideo(); | 348 PauseVideo(); |
335 } | 349 } |
336 | 350 |
337 void ContentViewCoreImpl::PauseVideo() { | 351 void ContentViewCoreImpl::PauseVideo() { |
338 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 352 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
339 if (host) | 353 if (host) |
340 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 354 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
341 } | 355 } |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1636 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1650 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1637 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1651 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1638 return reinterpret_cast<intptr_t>(view); | 1652 return reinterpret_cast<intptr_t>(view); |
1639 } | 1653 } |
1640 | 1654 |
1641 bool RegisterContentViewCore(JNIEnv* env) { | 1655 bool RegisterContentViewCore(JNIEnv* env) { |
1642 return RegisterNativesImpl(env); | 1656 return RegisterNativesImpl(env); |
1643 } | 1657 } |
1644 | 1658 |
1645 } // namespace content | 1659 } // namespace content |
OLD | NEW |