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/frame_host/interstitial_page_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); | 241 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); |
242 render_view_host_->AttachToFrameTree(); | 242 render_view_host_->AttachToFrameTree(); |
243 CreateWebContentsView(); | 243 CreateWebContentsView(); |
244 | 244 |
245 std::string data_url = "data:text/html;charset=utf-8," + | 245 std::string data_url = "data:text/html;charset=utf-8," + |
246 net::EscapePath(delegate_->GetHTMLContents()); | 246 net::EscapePath(delegate_->GetHTMLContents()); |
247 render_view_host_->NavigateToURL(GURL(data_url)); | 247 render_view_host_->NavigateToURL(GURL(data_url)); |
248 | 248 |
249 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, | 249 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, |
250 Source<NavigationController>(controller_)); | 250 Source<NavigationController>(controller_)); |
251 notification_registrar_.Add( | |
252 this, NOTIFICATION_DOM_OPERATION_RESPONSE, | |
253 Source<RenderViewHost>(render_view_host_)); | |
254 } | 251 } |
255 | 252 |
256 void InterstitialPageImpl::Hide() { | 253 void InterstitialPageImpl::Hide() { |
257 // We may have already been hidden, and are just waiting to be deleted. | 254 // We may have already been hidden, and are just waiting to be deleted. |
258 // We can't check for enabled() here, because some callers have already | 255 // We can't check for enabled() here, because some callers have already |
259 // called Disable. | 256 // called Disable. |
260 if (!render_view_host_) | 257 if (!render_view_host_) |
261 return; | 258 return; |
262 | 259 |
263 Disable(); | 260 Disable(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // closed); make sure we clear the blocked requests. | 335 // closed); make sure we clear the blocked requests. |
339 RenderViewHost* rvh = static_cast<RenderViewHost*>( | 336 RenderViewHost* rvh = static_cast<RenderViewHost*>( |
340 static_cast<RenderViewHostImpl*>( | 337 static_cast<RenderViewHostImpl*>( |
341 RenderWidgetHostImpl::From( | 338 RenderWidgetHostImpl::From( |
342 Source<RenderWidgetHost>(source).ptr()))); | 339 Source<RenderWidgetHost>(source).ptr()))); |
343 DCHECK(rvh->GetProcess()->GetID() == original_child_id_ && | 340 DCHECK(rvh->GetProcess()->GetID() == original_child_id_ && |
344 rvh->GetRoutingID() == original_rvh_id_); | 341 rvh->GetRoutingID() == original_rvh_id_); |
345 TakeActionOnResourceDispatcher(CANCEL); | 342 TakeActionOnResourceDispatcher(CANCEL); |
346 } | 343 } |
347 break; | 344 break; |
348 case NOTIFICATION_DOM_OPERATION_RESPONSE: | |
349 if (enabled()) { | |
350 Details<DomOperationNotificationDetails> dom_op_details( | |
351 details); | |
352 delegate_->CommandReceived(dom_op_details->json); | |
353 } | |
354 break; | |
355 default: | 345 default: |
356 NOTREACHED(); | 346 NOTREACHED(); |
357 } | 347 } |
358 } | 348 } |
359 | 349 |
360 void InterstitialPageImpl::NavigationEntryCommitted( | 350 void InterstitialPageImpl::NavigationEntryCommitted( |
361 const LoadCommittedDetails& load_details) { | 351 const LoadCommittedDetails& load_details) { |
362 OnNavigatingAwayOrTabClosing(); | 352 OnNavigatingAwayOrTabClosing(); |
363 } | 353 } |
364 | 354 |
365 void InterstitialPageImpl::WebContentsDestroyed(WebContents* web_contents) { | 355 void InterstitialPageImpl::WebContentsDestroyed(WebContents* web_contents) { |
366 OnNavigatingAwayOrTabClosing(); | 356 OnNavigatingAwayOrTabClosing(); |
367 } | 357 } |
368 | 358 |
369 void InterstitialPageImpl::RenderFrameCreated( | 359 void InterstitialPageImpl::RenderFrameCreated( |
370 RenderFrameHost* render_frame_host) { | 360 RenderFrameHost* render_frame_host) { |
371 // Note this is only for subframes in the interstitial, the notification for | 361 // Note this is only for subframes in the interstitial, the notification for |
372 // the main frame happens in RenderViewCreated. | 362 // the main frame happens in RenderViewCreated. |
373 controller_->delegate()->RenderFrameForInterstitialPageCreated( | 363 controller_->delegate()->RenderFrameForInterstitialPageCreated( |
374 render_frame_host); | 364 render_frame_host); |
375 } | 365 } |
376 | 366 |
| 367 void InterstitialPageImpl::OnDomOperationResponse( |
| 368 const DomOperationNotificationDetails& details) { |
| 369 // Needed by test code. |
| 370 NotificationService::current()->Notify( |
| 371 NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 372 Source<WebContents>(web_contents()), |
| 373 Details<const DomOperationNotificationDetails>(&details)); |
| 374 if (!enabled()) |
| 375 return; |
| 376 delegate_->CommandReceived(details.json); |
| 377 } |
| 378 |
377 RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() { | 379 RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() { |
378 return rvh_delegate_view_.get(); | 380 return rvh_delegate_view_.get(); |
379 } | 381 } |
380 | 382 |
381 const GURL& InterstitialPageImpl::GetURL() const { | 383 const GURL& InterstitialPageImpl::GetURL() const { |
382 return url_; | 384 return url_; |
383 } | 385 } |
384 | 386 |
385 void InterstitialPageImpl::RenderViewTerminated( | 387 void InterstitialPageImpl::RenderViewTerminated( |
386 RenderViewHost* render_view_host, | 388 RenderViewHost* render_view_host, |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 854 |
853 web_contents->GetDelegateView()->TakeFocus(reverse); | 855 web_contents->GetDelegateView()->TakeFocus(reverse); |
854 } | 856 } |
855 | 857 |
856 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( | 858 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( |
857 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 859 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
858 int active_match_ordinal, bool final_update) { | 860 int active_match_ordinal, bool final_update) { |
859 } | 861 } |
860 | 862 |
861 } // namespace content | 863 } // namespace content |
OLD | NEW |