Chromium Code Reviews| 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 "chromecast/browser/cast_content_window.h" | 9 #include "chromecast/browser/cast_content_window.h" |
| 10 #include "content/public/browser/devtools_agent_host.h" | 10 #include "content/public/browser/devtools_agent_host.h" |
| 11 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
| 15 #include "content/public/browser/render_widget_host_view.h" | |
| 15 #include "content/public/common/renderer_preferences.h" | 16 #include "content/public/common/renderer_preferences.h" |
| 16 #include "jni/CastWindowAndroid_jni.h" | 17 #include "jni/CastWindowAndroid_jni.h" |
| 18 #include "ui/gfx/skia_util.h" | |
| 17 | 19 |
| 18 namespace chromecast { | 20 namespace chromecast { |
| 19 namespace shell { | 21 namespace shell { |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 // The time (in milliseconds) we wait for after a page is closed (i.e. | 25 // The time (in milliseconds) we wait for after a page is closed (i.e. |
| 24 // after an app is stopped) before we delete the corresponding WebContents. | 26 // after an app is stopped) before we delete the corresponding WebContents. |
| 25 const int kWebContentsDestructionDelayInMs = 50; | 27 const int kWebContentsDestructionDelayInMs = 50; |
| 26 | 28 |
| 27 } // namespace | 29 } // namespace |
| 28 | 30 |
| 29 // static | 31 // static |
| 30 bool CastWindowAndroid::RegisterJni(JNIEnv* env) { | 32 bool CastWindowAndroid::RegisterJni(JNIEnv* env) { |
| 31 return RegisterNativesImpl(env); | 33 return RegisterNativesImpl(env); |
| 32 } | 34 } |
| 33 | 35 |
| 34 // static | 36 // static |
| 35 CastWindowAndroid* CastWindowAndroid::CreateNewWindow( | 37 CastWindowAndroid* CastWindowAndroid::CreateNewWindow( |
| 36 content::BrowserContext* browser_context, | 38 content::BrowserContext* browser_context, |
| 37 const GURL& url) { | 39 const GURL& url) { |
| 38 CastWindowAndroid* window_android = new CastWindowAndroid(browser_context); | 40 CastWindowAndroid* window_android = new CastWindowAndroid(browser_context); |
| 39 window_android->Initialize(); | 41 window_android->Initialize(); |
| 40 | 42 |
| 41 if (!url.is_empty()) | 43 if (!url.is_empty()) |
| 42 window_android->LoadURL(url); | 44 window_android->LoadURL(url); |
| 45 | |
| 46 content::RenderWidgetHostView* rwhv = | |
| 47 window_android->web_contents_->GetRenderWidgetHostView(); | |
|
gunsch
2015/02/24 05:55:09
optional: instead of accessing web_contents_ (priv
halliwell
2015/02/24 06:23:43
I don't believe there is such an API? WebContents
| |
| 48 if (rwhv) { | |
| 49 rwhv->SetBackgroundColor(SK_ColorBLACK); | |
| 50 } | |
| 51 | |
| 43 return window_android; | 52 return window_android; |
| 44 } | 53 } |
| 45 | 54 |
| 46 CastWindowAndroid::CastWindowAndroid(content::BrowserContext* browser_context) | 55 CastWindowAndroid::CastWindowAndroid(content::BrowserContext* browser_context) |
| 47 : browser_context_(browser_context), | 56 : browser_context_(browser_context), |
| 48 content_window_(new CastContentWindow), | 57 content_window_(new CastContentWindow), |
| 49 weak_factory_(this) { | 58 weak_factory_(this) { |
| 50 } | 59 } |
| 51 | 60 |
| 52 void CastWindowAndroid::Initialize() { | 61 void CastWindowAndroid::Initialize() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 contents->GetRenderViewHost()->Blur(); | 151 contents->GetRenderViewHost()->Blur(); |
| 143 } | 152 } |
| 144 | 153 |
| 145 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { | 154 void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { |
| 146 LOG(ERROR) << "Render process gone: status=" << status; | 155 LOG(ERROR) << "Render process gone: status=" << status; |
| 147 Destroy(); | 156 Destroy(); |
| 148 } | 157 } |
| 149 | 158 |
| 150 } // namespace shell | 159 } // namespace shell |
| 151 } // namespace chromecast | 160 } // namespace chromecast |
| OLD | NEW |