OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/constrained_html_ui.h" | 5 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 tab_container_->ChangeTabContents(html_tab_contents_->tab_contents()); | 115 tab_container_->ChangeTabContents(html_tab_contents_->tab_contents()); |
116 | 116 |
117 gfx::Size dialog_size; | 117 gfx::Size dialog_size; |
118 html_delegate_->GetDialogSize(&dialog_size); | 118 html_delegate_->GetDialogSize(&dialog_size); |
119 gtk_widget_set_size_request(GetWidgetRoot(), | 119 gtk_widget_set_size_request(GetWidgetRoot(), |
120 dialog_size.width(), | 120 dialog_size.width(), |
121 dialog_size.height()); | 121 dialog_size.height()); |
122 } | 122 } |
123 | 123 |
124 ConstrainedHtmlDelegateGtk::~ConstrainedHtmlDelegateGtk() { | 124 ConstrainedHtmlDelegateGtk::~ConstrainedHtmlDelegateGtk() { |
| 125 if (release_tab_on_close_) |
| 126 ignore_result(html_tab_contents_.release()); |
125 } | 127 } |
126 | 128 |
127 HtmlDialogUIDelegate* ConstrainedHtmlDelegateGtk::GetHtmlDialogUIDelegate() { | 129 HtmlDialogUIDelegate* ConstrainedHtmlDelegateGtk::GetHtmlDialogUIDelegate() { |
128 return html_delegate_; | 130 return html_delegate_; |
129 } | 131 } |
130 | 132 |
131 void ConstrainedHtmlDelegateGtk::OnDialogCloseFromWebUI() { | 133 void ConstrainedHtmlDelegateGtk::OnDialogCloseFromWebUI() { |
132 closed_via_webui_ = true; | 134 closed_via_webui_ = true; |
133 window_->CloseConstrainedWindow(); | 135 window_->CloseConstrainedWindow(); |
134 } | 136 } |
135 | 137 |
136 // static | 138 // static |
137 ConstrainedHtmlUIDelegate* ConstrainedHtmlUI::CreateConstrainedHtmlDialog( | 139 ConstrainedHtmlUIDelegate* ConstrainedHtmlUI::CreateConstrainedHtmlDialog( |
138 Profile* profile, | 140 Profile* profile, |
139 HtmlDialogUIDelegate* delegate, | 141 HtmlDialogUIDelegate* delegate, |
140 TabContentsWrapper* wrapper) { | 142 TabContentsWrapper* wrapper) { |
141 ConstrainedHtmlDelegateGtk* constrained_delegate = | 143 ConstrainedHtmlDelegateGtk* constrained_delegate = |
142 new ConstrainedHtmlDelegateGtk(profile, delegate); | 144 new ConstrainedHtmlDelegateGtk(profile, delegate); |
143 ConstrainedWindow* constrained_window = | 145 ConstrainedWindow* constrained_window = |
144 new ConstrainedWindowGtk(wrapper, constrained_delegate); | 146 new ConstrainedWindowGtk(wrapper, constrained_delegate); |
145 constrained_delegate->set_window(constrained_window); | 147 constrained_delegate->set_window(constrained_window); |
146 return constrained_delegate; | 148 return constrained_delegate; |
147 } | 149 } |
OLD | NEW |