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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 entry->set_page_type(PAGE_TYPE_INTERSTITIAL); | 230 entry->set_page_type(PAGE_TYPE_INTERSTITIAL); |
231 | 231 |
232 // Give delegates a chance to set some states on the navigation entry. | 232 // Give delegates a chance to set some states on the navigation entry. |
233 delegate_->OverrideEntry(entry); | 233 delegate_->OverrideEntry(entry); |
234 | 234 |
235 controller_->SetTransientEntry(entry); | 235 controller_->SetTransientEntry(entry); |
236 } | 236 } |
237 | 237 |
238 DCHECK(!render_view_host_); | 238 DCHECK(!render_view_host_); |
239 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); | 239 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); |
240 render_view_host_->AttachToFrameTree(); | |
241 CreateWebContentsView(); | 240 CreateWebContentsView(); |
242 | 241 |
243 std::string data_url = "data:text/html;charset=utf-8," + | 242 std::string data_url = "data:text/html;charset=utf-8," + |
244 net::EscapePath(delegate_->GetHTMLContents()); | 243 net::EscapePath(delegate_->GetHTMLContents()); |
245 render_view_host_->NavigateToURL(GURL(data_url)); | 244 render_view_host_->NavigateToURL(GURL(data_url)); |
246 | 245 |
247 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, | 246 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, |
248 Source<NavigationController>(controller_)); | 247 Source<NavigationController>(controller_)); |
249 notification_registrar_.Add( | 248 notification_registrar_.Add( |
250 this, NOTIFICATION_DOM_OPERATION_RESPONSE, | 249 this, NOTIFICATION_DOM_OPERATION_RESPONSE, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 283 } |
285 | 284 |
286 // Shutdown the RVH asynchronously, as we may have been called from a RVH | 285 // Shutdown the RVH asynchronously, as we may have been called from a RVH |
287 // delegate method, and we can't delete the RVH out from under itself. | 286 // delegate method, and we can't delete the RVH out from under itself. |
288 base::MessageLoop::current()->PostNonNestableTask( | 287 base::MessageLoop::current()->PostNonNestableTask( |
289 FROM_HERE, | 288 FROM_HERE, |
290 base::Bind(&InterstitialPageImpl::Shutdown, | 289 base::Bind(&InterstitialPageImpl::Shutdown, |
291 weak_ptr_factory_.GetWeakPtr(), | 290 weak_ptr_factory_.GetWeakPtr(), |
292 render_view_host_)); | 291 render_view_host_)); |
293 render_view_host_ = NULL; | 292 render_view_host_ = NULL; |
294 frame_tree_.SwapMainFrame(NULL); | 293 //frame_tree_.SwapMainFrame(NULL); |
295 controller_->delegate()->DetachInterstitialPage(); | 294 controller_->delegate()->DetachInterstitialPage(); |
296 // Let's revert to the original title if necessary. | 295 // Let's revert to the original title if necessary. |
297 NavigationEntry* entry = controller_->GetVisibleEntry(); | 296 NavigationEntry* entry = controller_->GetVisibleEntry(); |
298 if (!new_navigation_ && should_revert_web_contents_title_) { | 297 if (!new_navigation_ && should_revert_web_contents_title_) { |
299 entry->SetTitle(original_web_contents_title_); | 298 entry->SetTitle(original_web_contents_title_); |
300 controller_->delegate()->NotifyNavigationStateChanged( | 299 controller_->delegate()->NotifyNavigationStateChanged( |
301 INVALIDATE_TYPE_TITLE); | 300 INVALIDATE_TYPE_TITLE); |
302 } | 301 } |
303 | 302 |
304 InterstitialPageMap::iterator iter = | 303 InterstitialPageMap::iterator iter = |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 841 |
843 web_contents->GetDelegateView()->TakeFocus(reverse); | 842 web_contents->GetDelegateView()->TakeFocus(reverse); |
844 } | 843 } |
845 | 844 |
846 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( | 845 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( |
847 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 846 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
848 int active_match_ordinal, bool final_update) { | 847 int active_match_ordinal, bool final_update) { |
849 } | 848 } |
850 | 849 |
851 } // namespace content | 850 } // namespace content |
OLD | NEW |