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/views/html_dialog_view.h" | 5 #include "chrome/browser/views/html_dialog_view.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "chrome/browser/views/window.h" | 10 #include "chrome/browser/views/window.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 views::View* HtmlDialogView::GetContentsView() { | 93 views::View* HtmlDialogView::GetContentsView() { |
94 return this; | 94 return this; |
95 } | 95 } |
96 | 96 |
97 views::View* HtmlDialogView::GetInitiallyFocusedView() { | 97 views::View* HtmlDialogView::GetInitiallyFocusedView() { |
98 return this; | 98 return this; |
99 } | 99 } |
100 | 100 |
| 101 bool HtmlDialogView::ShouldShowWindowTitle() const { |
| 102 return ShouldShowDialogTitle(); |
| 103 } |
| 104 |
101 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
102 // HtmlDialogUIDelegate implementation: | 106 // HtmlDialogUIDelegate implementation: |
103 | 107 |
104 bool HtmlDialogView::IsDialogModal() const { | 108 bool HtmlDialogView::IsDialogModal() const { |
105 return IsModal(); | 109 return IsModal(); |
106 } | 110 } |
107 | 111 |
108 std::wstring HtmlDialogView::GetDialogTitle() const { | 112 std::wstring HtmlDialogView::GetDialogTitle() const { |
109 return GetWindowTitle(); | 113 return GetWindowTitle(); |
110 } | 114 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 147 } |
144 window()->Close(); | 148 window()->Close(); |
145 } | 149 } |
146 | 150 |
147 void HtmlDialogView::OnCloseContents(TabContents* source, | 151 void HtmlDialogView::OnCloseContents(TabContents* source, |
148 bool* out_close_dialog) { | 152 bool* out_close_dialog) { |
149 if (delegate_) | 153 if (delegate_) |
150 delegate_->OnCloseContents(source, out_close_dialog); | 154 delegate_->OnCloseContents(source, out_close_dialog); |
151 } | 155 } |
152 | 156 |
| 157 bool HtmlDialogView::ShouldShowDialogTitle() const { |
| 158 if (delegate_) |
| 159 return delegate_->ShouldShowDialogTitle(); |
| 160 else |
| 161 return true; |
| 162 } |
| 163 |
153 //////////////////////////////////////////////////////////////////////////////// | 164 //////////////////////////////////////////////////////////////////////////////// |
154 // TabContentsDelegate implementation: | 165 // TabContentsDelegate implementation: |
155 | 166 |
156 void HtmlDialogView::MoveContents(TabContents* source, const gfx::Rect& pos) { | 167 void HtmlDialogView::MoveContents(TabContents* source, const gfx::Rect& pos) { |
157 // The contained web page wishes to resize itself. We let it do this because | 168 // The contained web page wishes to resize itself. We let it do this because |
158 // if it's a dialog we know about, we trust it not to be mean to the user. | 169 // if it's a dialog we know about, we trust it not to be mean to the user. |
159 GetWidget()->SetBounds(pos); | 170 GetWidget()->SetBounds(pos); |
160 } | 171 } |
161 | 172 |
162 void HtmlDialogView::ToolbarSizeChanged(TabContents* source, | 173 void HtmlDialogView::ToolbarSizeChanged(TabContents* source, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Set the delegate. This must be done before loading the page. See | 210 // Set the delegate. This must be done before loading the page. See |
200 // the comment above HtmlDialogUI in its header file for why. | 211 // the comment above HtmlDialogUI in its header file for why. |
201 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), | 212 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), |
202 this); | 213 this); |
203 | 214 |
204 // Pressing the ESC key will close the dialog. | 215 // Pressing the ESC key will close the dialog. |
205 AddAccelerator(views::Accelerator(app::VKEY_ESCAPE, false, false, false)); | 216 AddAccelerator(views::Accelerator(app::VKEY_ESCAPE, false, false, false)); |
206 | 217 |
207 DOMView::LoadURL(GetDialogContentURL()); | 218 DOMView::LoadURL(GetDialogContentURL()); |
208 } | 219 } |
OLD | NEW |