| 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // static | 172 // static |
| 173 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( | 173 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( |
| 174 int render_process_id, int render_frame_id) { | 174 int render_process_id, int render_frame_id) { |
| 175 AwContents* aw_contents = AwContents::FromWebContents( | 175 AwContents* aw_contents = AwContents::FromWebContents( |
| 176 content::WebContents::FromRenderFrameHost( | 176 content::WebContents::FromRenderFrameHost( |
| 177 content::RenderFrameHost::FromID(render_process_id, | 177 content::RenderFrameHost::FromID(render_process_id, |
| 178 render_frame_id))); | 178 render_frame_id))); |
| 179 return aw_contents; | 179 return aw_contents; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // static |
| 183 AwSafeBrowsingUIManager::UIManagerClient* |
| 184 AwSafeBrowsingUIManager::UIManagerClient::FromWebContents( |
| 185 WebContents* web_contents) { |
| 186 return AwContents::FromWebContents(web_contents); |
| 187 } |
| 188 |
| 182 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) | 189 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) |
| 183 : content::WebContentsObserver(web_contents.get()), | 190 : content::WebContentsObserver(web_contents.get()), |
| 184 functor_(nullptr), | 191 functor_(nullptr), |
| 185 browser_view_renderer_( | 192 browser_view_renderer_( |
| 186 this, | 193 this, |
| 187 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), | 194 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), |
| 188 web_contents_(std::move(web_contents)), | 195 web_contents_(std::move(web_contents)), |
| 189 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { | 196 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { |
| 190 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 197 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
| 191 icon_helper_.reset(new IconHelper(web_contents_.get())); | 198 icon_helper_.reset(new IconHelper(web_contents_.get())); |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 void AwContents::DidAttachInterstitialPage() { | 1287 void AwContents::DidAttachInterstitialPage() { |
| 1281 CompositorID compositor_id; | 1288 CompositorID compositor_id; |
| 1282 RenderFrameHost* rfh = web_contents_->GetInterstitialPage()->GetMainFrame(); | 1289 RenderFrameHost* rfh = web_contents_->GetInterstitialPage()->GetMainFrame(); |
| 1283 compositor_id.process_id = rfh->GetProcess()->GetID(); | 1290 compositor_id.process_id = rfh->GetProcess()->GetID(); |
| 1284 compositor_id.routing_id = rfh->GetRenderViewHost()->GetRoutingID(); | 1291 compositor_id.routing_id = rfh->GetRenderViewHost()->GetRoutingID(); |
| 1285 browser_view_renderer_.SetActiveCompositorID(compositor_id); | 1292 browser_view_renderer_.SetActiveCompositorID(compositor_id); |
| 1286 } | 1293 } |
| 1287 | 1294 |
| 1288 void AwContents::DidDetachInterstitialPage() { | 1295 void AwContents::DidDetachInterstitialPage() { |
| 1289 CompositorID compositor_id; | 1296 CompositorID compositor_id; |
| 1297 if (!web_contents_) |
| 1298 return; |
| 1290 if (web_contents_->GetRenderProcessHost() && | 1299 if (web_contents_->GetRenderProcessHost() && |
| 1291 web_contents_->GetRenderViewHost()) { | 1300 web_contents_->GetRenderViewHost()) { |
| 1292 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); | 1301 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); |
| 1293 compositor_id.routing_id = | 1302 compositor_id.routing_id = |
| 1294 web_contents_->GetRenderViewHost()->GetRoutingID(); | 1303 web_contents_->GetRenderViewHost()->GetRoutingID(); |
| 1295 } else { | 1304 } else { |
| 1296 LOG(WARNING) << "failed setting the compositor on detaching interstitital"; | 1305 LOG(WARNING) << "failed setting the compositor on detaching interstitital"; |
| 1297 } | 1306 } |
| 1298 browser_view_renderer_.SetActiveCompositorID(compositor_id); | 1307 browser_view_renderer_.SetActiveCompositorID(compositor_id); |
| 1299 } | 1308 } |
| 1300 | 1309 |
| 1310 bool AwContents::CanShowInterstitial() { |
| 1311 JNIEnv* env = AttachCurrentThread(); |
| 1312 const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1313 if (obj.is_null()) |
| 1314 return false; |
| 1315 return Java_AwContents_canShowInterstitial(env, obj); |
| 1316 } |
| 1317 |
| 1301 } // namespace android_webview | 1318 } // namespace android_webview |
| OLD | NEW |