| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/tab_contents/interstitial_page_impl.h" | 5 #include "content/browser/tab_contents/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 24 matching lines...) Expand all Loading... |
| 35 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
| 36 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
| 37 | 37 |
| 38 using content::BrowserThread; | 38 using content::BrowserThread; |
| 39 using content::DomOperationNotificationDetails; | 39 using content::DomOperationNotificationDetails; |
| 40 using content::InterstitialPageDelegate; | 40 using content::InterstitialPageDelegate; |
| 41 using content::NavigationController; | 41 using content::NavigationController; |
| 42 using content::NavigationEntry; | 42 using content::NavigationEntry; |
| 43 using content::NavigationEntryImpl; | 43 using content::NavigationEntryImpl; |
| 44 using content::RenderViewHostDelegate; | 44 using content::RenderViewHostDelegate; |
| 45 using content::RenderWidgetHostViewPort; |
| 45 using content::SiteInstance; | 46 using content::SiteInstance; |
| 46 using content::WebContents; | 47 using content::WebContents; |
| 47 using content::WebContentsView; | 48 using content::WebContentsView; |
| 48 using WebKit::WebDragOperation; | 49 using WebKit::WebDragOperation; |
| 49 using WebKit::WebDragOperationsMask; | 50 using WebKit::WebDragOperationsMask; |
| 50 | 51 |
| 51 namespace { | 52 namespace { |
| 52 | 53 |
| 53 void ResourceRequestHelper(ResourceDispatcherHost* resource_dispatcher_host, | 54 void ResourceRequestHelper(ResourceDispatcherHost* resource_dispatcher_host, |
| 54 int process_id, | 55 int process_id, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Note that it is important that we don't call Show() if the view is | 267 // Note that it is important that we don't call Show() if the view is |
| 267 // already showing. That would result in bad things (unparented HWND on | 268 // already showing. That would result in bad things (unparented HWND on |
| 268 // Windows for example) happening. | 269 // Windows for example) happening. |
| 269 old_view->Show(); | 270 old_view->Show(); |
| 270 } | 271 } |
| 271 | 272 |
| 272 // If the focus was on the interstitial, let's keep it to the page. | 273 // If the focus was on the interstitial, let's keep it to the page. |
| 273 // (Note that in unit-tests the RVH may not have a view). | 274 // (Note that in unit-tests the RVH may not have a view). |
| 274 if (render_view_host_->view() && render_view_host_->view()->HasFocus() && | 275 if (render_view_host_->view() && render_view_host_->view()->HasFocus() && |
| 275 tab_->GetRenderViewHost()->view()) { | 276 tab_->GetRenderViewHost()->view()) { |
| 276 RenderWidgetHostViewBase::FromRWHV( | 277 RenderWidgetHostViewPort::FromRWHV( |
| 277 tab_->GetRenderViewHost()->view())->Focus(); | 278 tab_->GetRenderViewHost()->view())->Focus(); |
| 278 } | 279 } |
| 279 | 280 |
| 280 render_view_host_->Shutdown(); | 281 render_view_host_->Shutdown(); |
| 281 render_view_host_ = NULL; | 282 render_view_host_ = NULL; |
| 282 if (tab_->GetInterstitialPage()) | 283 if (tab_->GetInterstitialPage()) |
| 283 tab_->remove_interstitial_page(); | 284 tab_->remove_interstitial_page(); |
| 284 // Let's revert to the original title if necessary. | 285 // Let's revert to the original title if necessary. |
| 285 NavigationEntry* entry = tab_->GetController().GetActiveEntry(); | 286 NavigationEntry* entry = tab_->GetController().GetActiveEntry(); |
| 286 if (!new_navigation_ && should_revert_tab_title_) { | 287 if (!new_navigation_ && should_revert_tab_title_) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 if (render_view_host_->view()) | 589 if (render_view_host_->view()) |
| 589 render_view_host_->view()->SetSize(size); | 590 render_view_host_->view()->SetSize(size); |
| 590 #else | 591 #else |
| 591 // TODO(port): Does Mac need to SetSize? | 592 // TODO(port): Does Mac need to SetSize? |
| 592 NOTIMPLEMENTED(); | 593 NOTIMPLEMENTED(); |
| 593 #endif | 594 #endif |
| 594 } | 595 } |
| 595 | 596 |
| 596 void InterstitialPageImpl::Focus() { | 597 void InterstitialPageImpl::Focus() { |
| 597 // Focus the native window. | 598 // Focus the native window. |
| 598 RenderWidgetHostViewBase::FromRWHV(render_view_host_->view())->Focus(); | 599 RenderWidgetHostViewPort::FromRWHV(render_view_host_->view())->Focus(); |
| 599 } | 600 } |
| 600 | 601 |
| 601 void InterstitialPageImpl::FocusThroughTabTraversal(bool reverse) { | 602 void InterstitialPageImpl::FocusThroughTabTraversal(bool reverse) { |
| 602 render_view_host_->SetInitialFocus(reverse); | 603 render_view_host_->SetInitialFocus(reverse); |
| 603 } | 604 } |
| 604 | 605 |
| 605 RenderViewHost* InterstitialPageImpl::GetRenderViewHostForTesting() const { | 606 RenderViewHost* InterstitialPageImpl::GetRenderViewHostForTesting() const { |
| 606 return render_view_host_; | 607 return render_view_host_; |
| 607 } | 608 } |
| 608 | 609 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 if (!tab->GetViewDelegate()) | 735 if (!tab->GetViewDelegate()) |
| 735 return; | 736 return; |
| 736 | 737 |
| 737 tab->GetViewDelegate()->TakeFocus(reverse); | 738 tab->GetViewDelegate()->TakeFocus(reverse); |
| 738 } | 739 } |
| 739 | 740 |
| 740 void InterstitialPageImpl::InterstitialPageRVHViewDelegate::OnFindReply( | 741 void InterstitialPageImpl::InterstitialPageRVHViewDelegate::OnFindReply( |
| 741 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 742 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 742 int active_match_ordinal, bool final_update) { | 743 int active_match_ordinal, bool final_update) { |
| 743 } | 744 } |
| OLD | NEW |