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" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" |
14 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 17 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 18 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
17 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" | 19 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" |
18 #include "content/browser/frame_host/navigation_controller_impl.h" | 20 #include "content/browser/frame_host/navigation_controller_impl.h" |
19 #include "content/browser/frame_host/navigation_entry_impl.h" | 21 #include "content/browser/frame_host/navigation_entry_impl.h" |
20 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 22 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
21 #include "content/browser/renderer_host/render_process_host_impl.h" | 23 #include "content/browser/renderer_host/render_process_host_impl.h" |
22 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 24 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
23 #include "content/browser/renderer_host/render_view_host_factory.h" | 25 #include "content/browser/renderer_host/render_view_host_factory.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // (Note that in unit-tests the RVH may not have a view). | 284 // (Note that in unit-tests the RVH may not have a view). |
283 if (render_view_host_->GetView() && | 285 if (render_view_host_->GetView() && |
284 render_view_host_->GetView()->HasFocus() && | 286 render_view_host_->GetView()->HasFocus() && |
285 controller_->delegate()->GetRenderViewHost()->GetView()) { | 287 controller_->delegate()->GetRenderViewHost()->GetView()) { |
286 controller_->delegate()->GetRenderViewHost()->GetView()->Focus(); | 288 controller_->delegate()->GetRenderViewHost()->GetView()->Focus(); |
287 } | 289 } |
288 | 290 |
289 // Delete this and call Shutdown on the RVH asynchronously, as we may have | 291 // Delete this and call Shutdown on the RVH asynchronously, as we may have |
290 // been called from a RVH delegate method, and we can't delete the RVH out | 292 // been called from a RVH delegate method, and we can't delete the RVH out |
291 // from under itself. | 293 // from under itself. |
292 base::MessageLoop::current()->PostNonNestableTask( | 294 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( |
293 FROM_HERE, | 295 FROM_HERE, base::Bind(&InterstitialPageImpl::Shutdown, |
294 base::Bind(&InterstitialPageImpl::Shutdown, | 296 weak_ptr_factory_.GetWeakPtr())); |
295 weak_ptr_factory_.GetWeakPtr())); | |
296 render_view_host_ = NULL; | 297 render_view_host_ = NULL; |
297 frame_tree_.root()->ResetForNewProcess(); | 298 frame_tree_.root()->ResetForNewProcess(); |
298 controller_->delegate()->DetachInterstitialPage(); | 299 controller_->delegate()->DetachInterstitialPage(); |
299 // Let's revert to the original title if necessary. | 300 // Let's revert to the original title if necessary. |
300 NavigationEntry* entry = controller_->GetVisibleEntry(); | 301 NavigationEntry* entry = controller_->GetVisibleEntry(); |
301 if (entry && !new_navigation_ && should_revert_web_contents_title_) { | 302 if (entry && !new_navigation_ && should_revert_web_contents_title_) { |
302 entry->SetTitle(original_web_contents_title_); | 303 entry->SetTitle(original_web_contents_title_); |
303 controller_->delegate()->NotifyNavigationStateChanged( | 304 controller_->delegate()->NotifyNavigationStateChanged( |
304 INVALIDATE_TYPE_TITLE); | 305 INVALIDATE_TYPE_TITLE); |
305 } | 306 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( | 894 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( |
894 const LoadCommittedDetails& load_details) { | 895 const LoadCommittedDetails& load_details) { |
895 interstitial_->OnNavigatingAwayOrTabClosing(); | 896 interstitial_->OnNavigatingAwayOrTabClosing(); |
896 } | 897 } |
897 | 898 |
898 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 899 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
899 interstitial_->OnNavigatingAwayOrTabClosing(); | 900 interstitial_->OnNavigatingAwayOrTabClosing(); |
900 } | 901 } |
901 | 902 |
902 } // namespace content | 903 } // namespace content |
OLD | NEW |