OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 return; | 817 return; |
818 | 818 |
819 delegate_->ShowPageInfo(profile(), url, ssl, show_history); | 819 delegate_->ShowPageInfo(profile(), url, ssl, show_history); |
820 } | 820 } |
821 | 821 |
822 ConstrainedWindow* TabContents::CreateConstrainedDialog( | 822 ConstrainedWindow* TabContents::CreateConstrainedDialog( |
823 ConstrainedWindowDelegate* delegate) { | 823 ConstrainedWindowDelegate* delegate) { |
824 ConstrainedWindow* window = | 824 ConstrainedWindow* window = |
825 ConstrainedWindow::CreateConstrainedDialog(this, delegate); | 825 ConstrainedWindow::CreateConstrainedDialog(this, delegate); |
826 child_windows_.push_back(window); | 826 child_windows_.push_back(window); |
| 827 |
| 828 if (child_windows_.size() == 1) |
| 829 window->ShowConstrainedWindow(); |
| 830 |
827 return window; | 831 return window; |
828 } | 832 } |
829 | 833 |
830 void TabContents::AddNewContents(TabContents* new_contents, | 834 void TabContents::AddNewContents(TabContents* new_contents, |
831 WindowOpenDisposition disposition, | 835 WindowOpenDisposition disposition, |
832 const gfx::Rect& initial_pos, | 836 const gfx::Rect& initial_pos, |
833 bool user_gesture, | 837 bool user_gesture, |
834 const GURL& creator_url) { | 838 const GURL& creator_url) { |
835 if (!delegate_) | 839 if (!delegate_) |
836 return; | 840 return; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 // Download in a constrained popup is shown in the tab that opened it. | 1051 // Download in a constrained popup is shown in the tab that opened it. |
1048 TabContents* tab_contents = delegate()->GetConstrainingContents(this); | 1052 TabContents* tab_contents = delegate()->GetConstrainingContents(this); |
1049 | 1053 |
1050 if (tab_contents && tab_contents->delegate()) | 1054 if (tab_contents && tab_contents->delegate()) |
1051 tab_contents->delegate()->OnStartDownload(download); | 1055 tab_contents->delegate()->OnStartDownload(download); |
1052 } | 1056 } |
1053 | 1057 |
1054 void TabContents::WillClose(ConstrainedWindow* window) { | 1058 void TabContents::WillClose(ConstrainedWindow* window) { |
1055 ConstrainedWindowList::iterator it = | 1059 ConstrainedWindowList::iterator it = |
1056 find(child_windows_.begin(), child_windows_.end(), window); | 1060 find(child_windows_.begin(), child_windows_.end(), window); |
| 1061 |
| 1062 bool removed_topmost_window = it == child_windows_.begin(); |
1057 if (it != child_windows_.end()) | 1063 if (it != child_windows_.end()) |
1058 child_windows_.erase(it); | 1064 child_windows_.erase(it); |
| 1065 |
| 1066 if (removed_topmost_window && child_windows_.size() > 0) |
| 1067 child_windows_[0]->ShowConstrainedWindow(); |
1059 } | 1068 } |
1060 | 1069 |
1061 void TabContents::WillCloseBlockedPopupContainer( | 1070 void TabContents::WillCloseBlockedPopupContainer( |
1062 BlockedPopupContainer* container) { | 1071 BlockedPopupContainer* container) { |
1063 DCHECK(blocked_popups_ == container); | 1072 DCHECK(blocked_popups_ == container); |
1064 blocked_popups_ = NULL; | 1073 blocked_popups_ = NULL; |
1065 } | 1074 } |
1066 | 1075 |
1067 void TabContents::DidMoveOrResize(ConstrainedWindow* window) { | 1076 void TabContents::DidMoveOrResize(ConstrainedWindow* window) { |
1068 #if defined(OS_WIN) | 1077 #if defined(OS_WIN) |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, success, prompt); | 2720 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, success, prompt); |
2712 } | 2721 } |
2713 | 2722 |
2714 void TabContents::SetSuppressMessageBoxes(bool suppress_message_boxes) { | 2723 void TabContents::SetSuppressMessageBoxes(bool suppress_message_boxes) { |
2715 set_suppress_javascript_messages(suppress_message_boxes); | 2724 set_suppress_javascript_messages(suppress_message_boxes); |
2716 } | 2725 } |
2717 | 2726 |
2718 void TabContents::set_encoding(const std::string& encoding) { | 2727 void TabContents::set_encoding(const std::string& encoding) { |
2719 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2728 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2720 } | 2729 } |
OLD | NEW |