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/logging.h" | 7 #include "base/logging.h" |
8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/ui_base_switches_util.h" | |
11 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
12 #include "ui/views/bubble/bubble_frame_view.h" | 11 #include "ui/views/bubble/bubble_frame_view.h" |
13 #include "ui/views/controls/button/label_button.h" | 12 #include "ui/views/controls/button/label_button.h" |
14 #include "ui/views/controls/textfield/textfield.h" | 13 #include "ui/views/controls/textfield/textfield.h" |
15 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
16 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
17 #include "ui/views/window/dialog_client_view.h" | 16 #include "ui/views/window/dialog_client_view.h" |
18 | 17 |
19 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
20 #include "ui/views/corewm/shadow_types.h" | 19 #include "ui/views/corewm/shadow_types.h" |
21 #endif | 20 #endif |
22 | 21 |
23 namespace views { | 22 namespace views { |
24 | 23 |
25 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
26 // DialogDelegate: | 25 // DialogDelegate: |
27 | 26 |
28 DialogDelegate::~DialogDelegate() { | 27 DialogDelegate::~DialogDelegate() { |
29 } | 28 } |
30 | 29 |
31 // static | 30 // static |
32 bool DialogDelegate::UseNewStyle() { | 31 bool DialogDelegate::UseNewStyle() { |
33 return switches::IsNewDialogStyleEnabled() && | 32 // The new dialog style cannot host native Windows textfield controls. |
34 Textfield::IsViewsTextfieldEnabled(); | 33 return Textfield::IsViewsTextfieldEnabled(); |
35 } | 34 } |
36 | 35 |
37 // static | 36 // static |
38 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog, | 37 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog, |
39 gfx::NativeWindow context, | 38 gfx::NativeWindow context, |
40 gfx::NativeWindow parent) { | 39 gfx::NativeWindow parent) { |
41 views::Widget* widget = new views::Widget; | 40 views::Widget* widget = new views::Widget; |
42 views::Widget::InitParams params; | 41 views::Widget::InitParams params; |
43 params.delegate = dialog; | 42 params.delegate = dialog; |
44 const bool use_new_style = dialog ? | 43 const bool use_new_style = dialog ? |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 235 |
237 const Widget* DialogDelegateView::GetWidget() const { | 236 const Widget* DialogDelegateView::GetWidget() const { |
238 return View::GetWidget(); | 237 return View::GetWidget(); |
239 } | 238 } |
240 | 239 |
241 View* DialogDelegateView::GetContentsView() { | 240 View* DialogDelegateView::GetContentsView() { |
242 return this; | 241 return this; |
243 } | 242 } |
244 | 243 |
245 } // namespace views | 244 } // namespace views |
OLD | NEW |