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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 enabled_(true), | 155 enabled_(true), |
156 action_taken_(NO_ACTION), | 156 action_taken_(NO_ACTION), |
157 render_view_host_(NULL), | 157 render_view_host_(NULL), |
158 // TODO(nasko): The InterstitialPageImpl will need to provide its own | 158 // TODO(nasko): The InterstitialPageImpl will need to provide its own |
159 // NavigationControllerImpl to the Navigator, which is separate from | 159 // NavigationControllerImpl to the Navigator, which is separate from |
160 // the WebContents one, so we can enforce no navigation policy here. | 160 // the WebContents one, so we can enforce no navigation policy here. |
161 // While we get the code to a point to do this, pass NULL for it. | 161 // While we get the code to a point to do this, pass NULL for it. |
162 // TODO(creis): We will also need to pass delegates for the RVHM as we | 162 // TODO(creis): We will also need to pass delegates for the RVHM as we |
163 // start to use it. | 163 // start to use it. |
164 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_), | 164 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_), |
165 this, this, this, NULL), | 165 this, this, this, |
| 166 static_cast<WebContentsImpl*>(web_contents)), |
166 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), | 167 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), |
167 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), | 168 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), |
168 should_revert_web_contents_title_(false), | 169 should_revert_web_contents_title_(false), |
169 web_contents_was_loading_(false), | 170 web_contents_was_loading_(false), |
170 resource_dispatcher_host_notified_(false), | 171 resource_dispatcher_host_notified_(false), |
171 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), | 172 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), |
172 create_view_(true), | 173 create_view_(true), |
173 delegate_(delegate), | 174 delegate_(delegate), |
174 weak_ptr_factory_(this) { | 175 weak_ptr_factory_(this) { |
175 InitInterstitialPageMap(); | 176 InitInterstitialPageMap(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 entry->set_page_type(PAGE_TYPE_INTERSTITIAL); | 232 entry->set_page_type(PAGE_TYPE_INTERSTITIAL); |
232 | 233 |
233 // Give delegates a chance to set some states on the navigation entry. | 234 // Give delegates a chance to set some states on the navigation entry. |
234 delegate_->OverrideEntry(entry); | 235 delegate_->OverrideEntry(entry); |
235 | 236 |
236 controller_->SetTransientEntry(entry); | 237 controller_->SetTransientEntry(entry); |
237 } | 238 } |
238 | 239 |
239 DCHECK(!render_view_host_); | 240 DCHECK(!render_view_host_); |
240 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); | 241 render_view_host_ = static_cast<RenderViewHostImpl*>(CreateRenderViewHost()); |
241 render_view_host_->AttachToFrameTree(); | 242 // TODO(creis): Is this necessary? If so, move into CreateRenderViewHost. |
| 243 frame_tree_.ResetForMainFrameSwap(); |
242 CreateWebContentsView(); | 244 CreateWebContentsView(); |
243 | 245 |
244 std::string data_url = "data:text/html;charset=utf-8," + | 246 std::string data_url = "data:text/html;charset=utf-8," + |
245 net::EscapePath(delegate_->GetHTMLContents()); | 247 net::EscapePath(delegate_->GetHTMLContents()); |
246 render_view_host_->NavigateToURL(GURL(data_url)); | 248 render_view_host_->NavigateToURL(GURL(data_url)); |
247 | 249 |
248 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, | 250 notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, |
249 Source<NavigationController>(controller_)); | 251 Source<NavigationController>(controller_)); |
250 notification_registrar_.Add( | 252 notification_registrar_.Add( |
251 this, NOTIFICATION_DOM_OPERATION_RESPONSE, | 253 this, NOTIFICATION_DOM_OPERATION_RESPONSE, |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 | 853 |
852 web_contents->GetDelegateView()->TakeFocus(reverse); | 854 web_contents->GetDelegateView()->TakeFocus(reverse); |
853 } | 855 } |
854 | 856 |
855 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( | 857 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( |
856 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 858 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
857 int active_match_ordinal, bool final_update) { | 859 int active_match_ordinal, bool final_update) { |
858 } | 860 } |
859 | 861 |
860 } // namespace content | 862 } // namespace content |
OLD | NEW |