| 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/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "chromecast/browser/android/cast_window_manager.h" | 9 #include "chromecast/browser/android/cast_window_manager.h" |
| 10 #include "chromecast/browser/cast_content_window.h" | 10 #include "chromecast/browser/cast_content_window.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return window_android; | 54 return window_android; |
| 55 } | 55 } |
| 56 | 56 |
| 57 CastWindowAndroid::CastWindowAndroid(content::BrowserContext* browser_context) | 57 CastWindowAndroid::CastWindowAndroid(content::BrowserContext* browser_context) |
| 58 : browser_context_(browser_context), | 58 : browser_context_(browser_context), |
| 59 content_window_(new CastContentWindow), | 59 content_window_(new CastContentWindow), |
| 60 weak_factory_(this) { | 60 weak_factory_(this) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void CastWindowAndroid::Initialize() { | 63 void CastWindowAndroid::Initialize() { |
| 64 web_contents_ = | 64 web_contents_ = content_window_->CreateWebContents(browser_context_); |
| 65 content_window_->CreateWebContents(gfx::Size(), browser_context_); | |
| 66 web_contents_->SetDelegate(this); | 65 web_contents_->SetDelegate(this); |
| 67 content::WebContentsObserver::Observe(web_contents_.get()); | 66 content::WebContentsObserver::Observe(web_contents_.get()); |
| 68 | 67 |
| 69 JNIEnv* env = base::android::AttachCurrentThread(); | 68 JNIEnv* env = base::android::AttachCurrentThread(); |
| 70 window_java_.Reset(CreateCastWindowView(this)); | 69 window_java_.Reset(CreateCastWindowView(this)); |
| 71 | 70 |
| 72 Java_CastWindowAndroid_initFromNativeWebContents( | 71 Java_CastWindowAndroid_initFromNativeWebContents( |
| 73 env, window_java_.obj(), web_contents_->GetJavaWebContents().obj(), | 72 env, window_java_.obj(), web_contents_->GetJavaWebContents().obj(), |
| 74 web_contents_->GetRenderProcessHost()->GetID()); | 73 web_contents_->GetRenderProcessHost()->GetID()); |
| 75 | 74 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 contents->GetRenderViewHost()->GetWidget()->Focus(); | 149 contents->GetRenderViewHost()->GetWidget()->Focus(); |
| 151 } | 150 } |
| 152 | 151 |
| 153 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { | 152 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { |
| 154 LOG(ERROR) << "Render process gone: status=" << status; | 153 LOG(ERROR) << "Render process gone: status=" << status; |
| 155 Destroy(); | 154 Destroy(); |
| 156 } | 155 } |
| 157 | 156 |
| 158 } // namespace shell | 157 } // namespace shell |
| 159 } // namespace chromecast | 158 } // namespace chromecast |
| OLD | NEW |