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::DisableMediaAutoplay(JNIEnv* env, jobject obj) { | |
333 SetMediaAutoplayEnabled(false); | |
334 } | |
335 | |
336 void ContentViewCoreImpl::EnableMediaAutoplay() { | |
337 SetMediaAutoplayEnabled(true); | |
338 } | |
339 | |
340 void ContentViewCoreImpl::SetMediaAutoplayEnabled(bool isEnabled) { | |
Ted C
2013/11/26 19:24:29
c++ naming for variables doesn't use camel casing.
apiccion
2013/12/03 02:29:19
Done.
| |
341 if (isEnabled == is_media_autoplay_enabled_) return; | |
Ted C
2013/11/26 19:24:29
return needs to be on the next line.
Also, why do
apiccion
2013/12/03 02:29:19
GetWebkitPreferences() would be better understood
| |
342 is_media_autoplay_enabled_ = isEnabled; | |
343 RenderViewHost* host = web_contents_->GetRenderViewHost(); | |
344 WebPreferences prefs = host->GetWebkitPreferences(); | |
345 prefs.user_gesture_required_for_media_playback = !isEnabled; | |
346 host->UpdateWebkitPreferences(prefs); | |
347 } | |
348 | |
349 | |
Ted C
2013/11/26 19:24:29
remove extra blank line
apiccion
2013/12/03 02:29:19
Done.
| |
332 void ContentViewCoreImpl::Hide() { | 350 void ContentViewCoreImpl::Hide() { |
333 GetWebContents()->WasHidden(); | 351 GetWebContents()->WasHidden(); |
334 PauseVideo(); | 352 PauseVideo(); |
335 } | 353 } |
336 | 354 |
337 void ContentViewCoreImpl::PauseVideo() { | 355 void ContentViewCoreImpl::PauseVideo() { |
338 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 356 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
339 if (host) | 357 if (host) |
340 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 358 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
341 } | 359 } |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1636 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1654 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1637 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1655 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1638 return reinterpret_cast<intptr_t>(view); | 1656 return reinterpret_cast<intptr_t>(view); |
1639 } | 1657 } |
1640 | 1658 |
1641 bool RegisterContentViewCore(JNIEnv* env) { | 1659 bool RegisterContentViewCore(JNIEnv* env) { |
1642 return RegisterNativesImpl(env); | 1660 return RegisterNativesImpl(env); |
1643 } | 1661 } |
1644 | 1662 |
1645 } // namespace content | 1663 } // namespace content |
OLD | NEW |