Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 | 177 |
| 178 void WebContentsAndroid::OnHide(JNIEnv* env, jobject obj) { | 178 void WebContentsAndroid::OnHide(JNIEnv* env, jobject obj) { |
| 179 web_contents_->WasHidden(); | 179 web_contents_->WasHidden(); |
| 180 PauseVideo(); | 180 PauseVideo(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void WebContentsAndroid::OnShow(JNIEnv* env, jobject obj) { | 183 void WebContentsAndroid::OnShow(JNIEnv* env, jobject obj) { |
| 184 web_contents_->WasShown(); | 184 web_contents_->WasShown(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void WebContentsAndroid::ReleaseMediaPlayers(JNIEnv* env, jobject jobj) { | |
| 188 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | |
| 189 web_contents_->GetRenderViewHost()); | |
|
qinmin
2014/08/22 21:49:32
nit: indent -2
David Trainor- moved to gerrit
2014/08/25 18:11:43
Done.
| |
| 190 if (rvhi && rvhi->GetMainFrame()) { | |
|
qinmin
2014/08/22 21:49:32
indent -2 and below
David Trainor- moved to gerrit
2014/08/25 18:11:43
Done.
| |
| 191 rvhi->media_web_contents_observer()->ReleaseAllMediaPlayers( | |
| 192 rvhi->GetMainFrame()); | |
| 193 } | |
| 194 } | |
| 195 | |
| 187 void WebContentsAndroid::PauseVideo() { | 196 void WebContentsAndroid::PauseVideo() { |
| 188 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 197 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 189 web_contents_->GetRenderViewHost()); | 198 web_contents_->GetRenderViewHost()); |
| 190 if (rvhi) | 199 if (rvhi) |
| 191 rvhi->media_web_contents_observer()->PauseVideo(); | 200 rvhi->media_web_contents_observer()->PauseVideo(); |
| 192 } | 201 } |
| 193 | 202 |
| 194 void WebContentsAndroid::AddStyleSheetByURL( | 203 void WebContentsAndroid::AddStyleSheetByURL( |
| 195 JNIEnv* env, | 204 JNIEnv* env, |
| 196 jobject obj, | 205 jobject obj, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 ScopedJavaGlobalRef<jobject> j_callback; | 361 ScopedJavaGlobalRef<jobject> j_callback; |
| 353 j_callback.Reset(env, callback); | 362 j_callback.Reset(env, callback); |
| 354 content::RenderFrameHost::JavaScriptResultCallback js_callback = | 363 content::RenderFrameHost::JavaScriptResultCallback js_callback = |
| 355 base::Bind(&JavaScriptResultCallback, j_callback); | 364 base::Bind(&JavaScriptResultCallback, j_callback); |
| 356 | 365 |
| 357 web_contents_->GetMainFrame()->ExecuteJavaScript( | 366 web_contents_->GetMainFrame()->ExecuteJavaScript( |
| 358 ConvertJavaStringToUTF16(env, script), js_callback); | 367 ConvertJavaStringToUTF16(env, script), js_callback); |
| 359 } | 368 } |
| 360 | 369 |
| 361 } // namespace content | 370 } // namespace content |
| OLD | NEW |