| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/android/cast_window_android.h" | 5 #include "chromecast/browser/android/cast_window_android.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "chromecast/browser/android/cast_window_manager.h" | 8 #include "chromecast/browser/android/cast_window_manager.h" |
| 9 #include "content/public/browser/devtools_agent_host.h" | 9 #include "content/public/browser/devtools_agent_host.h" |
| 10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
| 12 #include "content/public/browser/render_process_host.h" |
| 12 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 13 #include "content/public/common/renderer_preferences.h" | 14 #include "content/public/common/renderer_preferences.h" |
| 14 #include "jni/CastWindowAndroid_jni.h" | 15 #include "jni/CastWindowAndroid_jni.h" |
| 15 | 16 |
| 16 namespace chromecast { | 17 namespace chromecast { |
| 17 namespace shell { | 18 namespace shell { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // The time (in milliseconds) we wait for after a page is closed (i.e. | 22 // The time (in milliseconds) we wait for after a page is closed (i.e. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 62 |
| 62 JNIEnv* env = base::android::AttachCurrentThread(); | 63 JNIEnv* env = base::android::AttachCurrentThread(); |
| 63 base::android::ScopedJavaLocalRef<jobject> shell_android( | 64 base::android::ScopedJavaLocalRef<jobject> shell_android( |
| 64 CreateCastWindowView(shell)); | 65 CreateCastWindowView(shell)); |
| 65 | 66 |
| 66 shell->java_object_.Reset(env, shell_android.Release()); | 67 shell->java_object_.Reset(env, shell_android.Release()); |
| 67 shell->web_contents_.reset(web_contents); | 68 shell->web_contents_.reset(web_contents); |
| 68 web_contents->SetDelegate(shell); | 69 web_contents->SetDelegate(shell); |
| 69 | 70 |
| 70 Java_CastWindowAndroid_initFromNativeWebContents( | 71 Java_CastWindowAndroid_initFromNativeWebContents( |
| 71 env, shell->java_object_.obj(), reinterpret_cast<jint>(web_contents)); | 72 env, shell->java_object_.obj(), reinterpret_cast<jint>(web_contents), |
| 73 web_contents->GetRenderProcessHost()->GetID()); |
| 72 | 74 |
| 73 // Enabling hole-punching also requires runtime renderer preference | 75 // Enabling hole-punching also requires runtime renderer preference |
| 74 web_contents->GetMutableRendererPrefs()-> | 76 web_contents->GetMutableRendererPrefs()-> |
| 75 use_video_overlay_for_embedded_encrypted_video = true; | 77 use_video_overlay_for_embedded_encrypted_video = true; |
| 76 web_contents->GetRenderViewHost()->SyncRendererPrefs(); | 78 web_contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 77 | 79 |
| 78 return shell; | 80 return shell; |
| 79 } | 81 } |
| 80 | 82 |
| 81 void CastWindowAndroid::Close() { | 83 void CastWindowAndroid::Close() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 contents->GetRenderViewHost()->Blur(); | 165 contents->GetRenderViewHost()->Blur(); |
| 164 } | 166 } |
| 165 | 167 |
| 166 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { | 168 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { |
| 167 LOG(ERROR) << "Render process gone: status=" << status; | 169 LOG(ERROR) << "Render process gone: status=" << status; |
| 168 Destroy(); | 170 Destroy(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 } // namespace shell | 173 } // namespace shell |
| 172 } // namespace chromecast | 174 } // namespace chromecast |
| OLD | NEW |