OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/window/dialog_delegate.h" | 5 #include "ui/views/window/dialog_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/base/ui_base_switches.h" | 9 #include "ui/base/ui_base_switches.h" |
10 #include "ui/views/controls/button/text_button.h" | 10 #include "ui/views/controls/button/text_button.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return GetWidget()->client_view()->AsDialogClientView(); | 144 return GetWidget()->client_view()->AsDialogClientView(); |
145 } | 145 } |
146 | 146 |
147 ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const { | 147 ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const { |
148 return ui::AccessibilityTypes::ROLE_DIALOG; | 148 return ui::AccessibilityTypes::ROLE_DIALOG; |
149 } | 149 } |
150 | 150 |
151 //////////////////////////////////////////////////////////////////////////////// | 151 //////////////////////////////////////////////////////////////////////////////// |
152 // DialogDelegateView: | 152 // DialogDelegateView: |
153 | 153 |
154 DialogDelegateView::DialogDelegateView() {} | 154 DialogDelegateView::DialogDelegateView() { |
| 155 // A WidgetDelegate should be deleted on DeleteDelegate. |
| 156 set_owned_by_client(); |
| 157 } |
155 | 158 |
156 DialogDelegateView::~DialogDelegateView() {} | 159 DialogDelegateView::~DialogDelegateView() {} |
157 | 160 |
158 // static | 161 // static |
159 Widget* DialogDelegateView::CreateDialogWidget(DialogDelegateView* dialog, | 162 Widget* DialogDelegateView::CreateDialogWidget(DialogDelegateView* dialog, |
160 gfx::NativeWindow context, | 163 gfx::NativeWindow context, |
161 gfx::NativeWindow parent) { | 164 gfx::NativeWindow parent) { |
162 return CreateDialogWidgetImpl(dialog, context, parent); | 165 return CreateDialogWidgetImpl(dialog, context, parent); |
163 } | 166 } |
164 | 167 |
| 168 void DialogDelegateView::DeleteDelegate() { |
| 169 delete this; |
| 170 } |
| 171 |
165 Widget* DialogDelegateView::GetWidget() { | 172 Widget* DialogDelegateView::GetWidget() { |
166 return View::GetWidget(); | 173 return View::GetWidget(); |
167 } | 174 } |
168 | 175 |
169 const Widget* DialogDelegateView::GetWidget() const { | 176 const Widget* DialogDelegateView::GetWidget() const { |
170 return View::GetWidget(); | 177 return View::GetWidget(); |
171 } | 178 } |
172 | 179 |
173 View* DialogDelegateView::GetContentsView() { | 180 View* DialogDelegateView::GetContentsView() { |
174 return this; | 181 return this; |
175 } | 182 } |
176 | 183 |
177 } // namespace views | 184 } // namespace views |
OLD | NEW |