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