| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/tab_contents/interstitial_page.h" | 5 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual void ShowCreatedWindow(int route_id, | 76 virtual void ShowCreatedWindow(int route_id, |
| 77 WindowOpenDisposition disposition, | 77 WindowOpenDisposition disposition, |
| 78 const gfx::Rect& initial_pos, | 78 const gfx::Rect& initial_pos, |
| 79 bool user_gesture, | 79 bool user_gesture, |
| 80 const GURL& creator_url); | 80 const GURL& creator_url); |
| 81 virtual void ShowCreatedWidget(int route_id, | 81 virtual void ShowCreatedWidget(int route_id, |
| 82 const gfx::Rect& initial_pos); | 82 const gfx::Rect& initial_pos); |
| 83 virtual void ShowContextMenu(const ContextMenuParams& params); | 83 virtual void ShowContextMenu(const ContextMenuParams& params); |
| 84 virtual void StartDragging(const WebDropData& drop_data); | 84 virtual void StartDragging(const WebDropData& drop_data); |
| 85 virtual void UpdateDragCursor(bool is_drop_target); | 85 virtual void UpdateDragCursor(bool is_drop_target); |
| 86 virtual void GotFocus(); |
| 86 virtual void TakeFocus(bool reverse); | 87 virtual void TakeFocus(bool reverse); |
| 87 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 88 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 88 virtual void HandleMouseEvent(); | 89 virtual void HandleMouseEvent(); |
| 89 virtual void HandleMouseLeave(); | 90 virtual void HandleMouseLeave(); |
| 90 virtual void OnFindReply(int request_id, | 91 virtual void OnFindReply(int request_id, |
| 91 int number_of_matches, | 92 int number_of_matches, |
| 92 const gfx::Rect& selection_rect, | 93 const gfx::Rect& selection_rect, |
| 93 int active_match_ordinal, | 94 int active_match_ordinal, |
| 94 bool final_update); | 95 bool final_update); |
| 95 virtual void UpdatePreferredWidth(int pref_width); | 96 virtual void UpdatePreferredWidth(int pref_width); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 204 } |
| 204 | 205 |
| 205 void InterstitialPage::Hide() { | 206 void InterstitialPage::Hide() { |
| 206 RenderWidgetHostView* old_view = tab_->render_view_host()->view(); | 207 RenderWidgetHostView* old_view = tab_->render_view_host()->view(); |
| 207 if (old_view) { | 208 if (old_view) { |
| 208 // Show the original RVH since we're going away. Note it might not exist if | 209 // Show the original RVH since we're going away. Note it might not exist if |
| 209 // the renderer crashed while the interstitial was showing. | 210 // the renderer crashed while the interstitial was showing. |
| 210 old_view->Show(); | 211 old_view->Show(); |
| 211 } | 212 } |
| 212 | 213 |
| 214 // If the focus was on the interstitial, let's keep it to the page. |
| 215 // (Note that in unit-tests the RVH may not have a view). |
| 216 if (render_view_host_->view() && render_view_host_->view()->HasFocus() && |
| 217 tab_->render_view_host()->view()) { |
| 218 tab_->render_view_host()->view()->Focus(); |
| 219 } |
| 220 |
| 213 render_view_host_->Shutdown(); | 221 render_view_host_->Shutdown(); |
| 214 render_view_host_ = NULL; | 222 render_view_host_ = NULL; |
| 215 if (tab_->interstitial_page()) | 223 if (tab_->interstitial_page()) |
| 216 tab_->remove_interstitial_page(); | 224 tab_->remove_interstitial_page(); |
| 217 // Let's revert to the original title if necessary. | 225 // Let's revert to the original title if necessary. |
| 218 NavigationEntry* entry = tab_->controller().GetActiveEntry(); | 226 NavigationEntry* entry = tab_->controller().GetActiveEntry(); |
| 219 if (!new_navigation_ && should_revert_tab_title_) { | 227 if (!new_navigation_ && should_revert_tab_title_) { |
| 220 entry->set_title(WideToUTF16Hack(original_tab_title_)); | 228 entry->set_title(WideToUTF16Hack(original_tab_title_)); |
| 221 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); | 229 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); |
| 222 } | 230 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 void InterstitialPage::InterstitialPageRVHViewDelegate::StartDragging( | 520 void InterstitialPage::InterstitialPageRVHViewDelegate::StartDragging( |
| 513 const WebDropData& drop_data) { | 521 const WebDropData& drop_data) { |
| 514 NOTREACHED() << "InterstitialPage does not support dragging yet."; | 522 NOTREACHED() << "InterstitialPage does not support dragging yet."; |
| 515 } | 523 } |
| 516 | 524 |
| 517 void InterstitialPage::InterstitialPageRVHViewDelegate::UpdateDragCursor( | 525 void InterstitialPage::InterstitialPageRVHViewDelegate::UpdateDragCursor( |
| 518 bool is_drop_target) { | 526 bool is_drop_target) { |
| 519 NOTREACHED() << "InterstitialPage does not support dragging yet."; | 527 NOTREACHED() << "InterstitialPage does not support dragging yet."; |
| 520 } | 528 } |
| 521 | 529 |
| 530 void InterstitialPage::InterstitialPageRVHViewDelegate::GotFocus() { |
| 531 } |
| 532 |
| 522 void InterstitialPage::InterstitialPageRVHViewDelegate::UpdatePreferredWidth( | 533 void InterstitialPage::InterstitialPageRVHViewDelegate::UpdatePreferredWidth( |
| 523 int pref_width) { | 534 int pref_width) { |
| 524 } | 535 } |
| 525 | 536 |
| 526 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( | 537 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( |
| 527 bool reverse) { | 538 bool reverse) { |
| 528 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) | 539 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) |
| 529 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); | 540 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); |
| 530 } | 541 } |
| 531 | 542 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 542 | 553 |
| 543 void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseLeave() { | 554 void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseLeave() { |
| 544 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) | 555 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) |
| 545 interstitial_page_->tab()->GetViewDelegate()->HandleMouseLeave(); | 556 interstitial_page_->tab()->GetViewDelegate()->HandleMouseLeave(); |
| 546 } | 557 } |
| 547 | 558 |
| 548 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 559 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 549 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 560 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 550 int active_match_ordinal, bool final_update) { | 561 int active_match_ordinal, bool final_update) { |
| 551 } | 562 } |
| OLD | NEW |