Chromium Code Reviews| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/aura/window_event_dispatcher.h" | 8 #include "ui/aura/window_event_dispatcher.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/controls/button/checkbox.h" | 10 #include "ui/views/controls/button/checkbox.h" |
| 11 #include "ui/views/controls/button/label_button.h" | 11 #include "ui/views/controls/button/md_text_button.h" |
| 12 #include "ui/views/controls/button/radio_button.h" | 12 #include "ui/views/controls/button/radio_button.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Default window position. | 18 // Default window position. |
| 19 const int kWindowLeft = 170; | 19 const int kWindowLeft = 170; |
| 20 const int kWindowTop = 200; | 20 const int kWindowTop = 200; |
| 21 | 21 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 46 views::Checkbox* checkbox_disabled_; | 46 views::Checkbox* checkbox_disabled_; |
| 47 views::Checkbox* checkbox_checked_; | 47 views::Checkbox* checkbox_checked_; |
| 48 views::Checkbox* checkbox_checked_disabled_; | 48 views::Checkbox* checkbox_checked_disabled_; |
| 49 views::RadioButton* radio_button_; | 49 views::RadioButton* radio_button_; |
| 50 views::RadioButton* radio_button_disabled_; | 50 views::RadioButton* radio_button_disabled_; |
| 51 views::RadioButton* radio_button_selected_; | 51 views::RadioButton* radio_button_selected_; |
| 52 views::RadioButton* radio_button_selected_disabled_; | 52 views::RadioButton* radio_button_selected_disabled_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 WidgetsWindow::WidgetsWindow() | 55 WidgetsWindow::WidgetsWindow() |
| 56 : button_(new views::LabelButton(NULL, base::ASCIIToUTF16("Button"))), | 56 : button_( |
| 57 disabled_button_( | 57 views::MdTextButton::CreateMdButton(NULL, |
| 58 new views::LabelButton(NULL, base::ASCIIToUTF16("Disabled button"))), | 58 base::ASCIIToUTF16("Button"))), |
| 59 disabled_button_(views::MdTextButton::CreateMdButton( | |
| 60 NULL, | |
|
James Cook
2016/09/01 02:35:57
nit: nullptr since you're touching the lines anywa
Evan Stade
2016/09/01 20:02:44
Done.
| |
| 61 base::ASCIIToUTF16("Disabled button"))), | |
| 59 checkbox_(new views::Checkbox(base::ASCIIToUTF16("Checkbox"))), | 62 checkbox_(new views::Checkbox(base::ASCIIToUTF16("Checkbox"))), |
| 60 checkbox_disabled_( | 63 checkbox_disabled_( |
| 61 new views::Checkbox(base::ASCIIToUTF16("Checkbox disabled"))), | 64 new views::Checkbox(base::ASCIIToUTF16("Checkbox disabled"))), |
| 62 checkbox_checked_( | 65 checkbox_checked_( |
| 63 new views::Checkbox(base::ASCIIToUTF16("Checkbox checked"))), | 66 new views::Checkbox(base::ASCIIToUTF16("Checkbox checked"))), |
| 64 checkbox_checked_disabled_( | 67 checkbox_checked_disabled_( |
| 65 new views::Checkbox(base::ASCIIToUTF16("Checkbox checked disabled"))), | 68 new views::Checkbox(base::ASCIIToUTF16("Checkbox checked disabled"))), |
| 66 radio_button_( | 69 radio_button_( |
| 67 new views::RadioButton(base::ASCIIToUTF16("Radio button"), 0)), | 70 new views::RadioButton(base::ASCIIToUTF16("Radio button"), 0)), |
| 68 radio_button_disabled_( | 71 radio_button_disabled_( |
| 69 new views::RadioButton(base::ASCIIToUTF16("Radio button disabled"), | 72 new views::RadioButton(base::ASCIIToUTF16("Radio button disabled"), |
| 70 0)), | 73 0)), |
| 71 radio_button_selected_( | 74 radio_button_selected_( |
| 72 new views::RadioButton(base::ASCIIToUTF16("Radio button selected"), | 75 new views::RadioButton(base::ASCIIToUTF16("Radio button selected"), |
| 73 0)), | 76 0)), |
| 74 radio_button_selected_disabled_(new views::RadioButton( | 77 radio_button_selected_disabled_(new views::RadioButton( |
| 75 base::ASCIIToUTF16("Radio button selected disabled"), | 78 base::ASCIIToUTF16("Radio button selected disabled"), |
| 76 1)) { | 79 1)) { |
| 77 button_->SetStyle(views::Button::STYLE_BUTTON); | |
| 78 AddChildView(button_); | 80 AddChildView(button_); |
| 79 disabled_button_->SetEnabled(false); | 81 disabled_button_->SetEnabled(false); |
| 80 disabled_button_->SetStyle(views::Button::STYLE_BUTTON); | |
| 81 AddChildView(disabled_button_); | 82 AddChildView(disabled_button_); |
| 82 AddChildView(checkbox_); | 83 AddChildView(checkbox_); |
| 83 checkbox_disabled_->SetEnabled(false); | 84 checkbox_disabled_->SetEnabled(false); |
| 84 AddChildView(checkbox_disabled_); | 85 AddChildView(checkbox_disabled_); |
| 85 checkbox_checked_->SetChecked(true); | 86 checkbox_checked_->SetChecked(true); |
| 86 AddChildView(checkbox_checked_); | 87 AddChildView(checkbox_checked_); |
| 87 checkbox_checked_disabled_->SetChecked(true); | 88 checkbox_checked_disabled_->SetChecked(true); |
| 88 checkbox_checked_disabled_->SetEnabled(false); | 89 checkbox_checked_disabled_->SetEnabled(false); |
| 89 AddChildView(checkbox_checked_disabled_); | 90 AddChildView(checkbox_checked_disabled_); |
| 90 AddChildView(radio_button_); | 91 AddChildView(radio_button_); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 void CreateWidgetsWindow() { | 140 void CreateWidgetsWindow() { |
| 140 gfx::Rect bounds(kWindowLeft, kWindowTop, kWindowWidth, kWindowHeight); | 141 gfx::Rect bounds(kWindowLeft, kWindowTop, kWindowWidth, kWindowHeight); |
| 141 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( | 142 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
| 142 new WidgetsWindow, Shell::GetPrimaryRootWindow(), bounds); | 143 new WidgetsWindow, Shell::GetPrimaryRootWindow(), bounds); |
| 143 widget->GetNativeView()->SetName("WidgetsWindow"); | 144 widget->GetNativeView()->SetName("WidgetsWindow"); |
| 144 widget->Show(); | 145 widget->Show(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace shell | 148 } // namespace shell |
| 148 } // namespace ash | 149 } // namespace ash |
| OLD | NEW |