| 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/common/session/session_state_delegate.h" | 5 #include "ash/common/session/session_state_delegate.h" |
| 6 #include "ash/common/shell_window_ids.h" | 6 #include "ash/common/shell_window_ids.h" |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell/example_factory.h" | 9 #include "ash/shell/example_factory.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 14 #include "ui/gfx/font_list.h" | 14 #include "ui/gfx/font_list.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/text_utils.h" | 16 #include "ui/gfx/text_utils.h" |
| 17 #include "ui/views/controls/button/label_button.h" | 17 #include "ui/views/controls/button/md_text_button.h" |
| 18 #include "ui/views/corewm/tooltip_controller.h" | 18 #include "ui/views/corewm/tooltip_controller.h" |
| 19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/widget/widget_delegate.h" | 20 #include "ui/views/widget/widget_delegate.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 namespace shell { | 23 namespace shell { |
| 24 | 24 |
| 25 class LockView : public views::WidgetDelegateView, | 25 class LockView : public views::WidgetDelegateView, |
| 26 public views::ButtonListener { | 26 public views::ButtonListener { |
| 27 public: | 27 public: |
| 28 LockView() | 28 LockView() |
| 29 : unlock_button_( | 29 : unlock_button_( |
| 30 new views::LabelButton(this, base::ASCIIToUTF16("Unlock"))) { | 30 views::MdTextButton::CreateMdButton(this, |
| 31 unlock_button_->SetStyle(views::Button::STYLE_BUTTON); | 31 base::ASCIIToUTF16("Unlock"))) { |
| 32 AddChildView(unlock_button_); | 32 AddChildView(unlock_button_); |
| 33 } | 33 } |
| 34 ~LockView() override {} | 34 ~LockView() override {} |
| 35 | 35 |
| 36 // Overridden from views::View: | 36 // Overridden from views::View: |
| 37 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); } | 37 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // Overridden from views::View: | 40 // Overridden from views::View: |
| 41 void OnPaint(gfx::Canvas* canvas) override { | 41 void OnPaint(gfx::Canvas* canvas) override { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 66 WmShell::Get()->GetSessionStateDelegate()->UnlockScreen(); | 66 WmShell::Get()->GetSessionStateDelegate()->UnlockScreen(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Overridden from views::ButtonListener: | 69 // Overridden from views::ButtonListener: |
| 70 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 70 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| 71 DCHECK(sender == unlock_button_); | 71 DCHECK(sender == unlock_button_); |
| 72 GetWidget()->Close(); | 72 GetWidget()->Close(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 gfx::FontList font_list_; | 75 gfx::FontList font_list_; |
| 76 views::LabelButton* unlock_button_; | 76 views::Button* unlock_button_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(LockView); | 78 DISALLOW_COPY_AND_ASSIGN(LockView); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 void CreateLockScreen() { | 81 void CreateLockScreen() { |
| 82 LockView* lock_view = new LockView; | 82 LockView* lock_view = new LockView; |
| 83 views::Widget* widget = new views::Widget; | 83 views::Widget* widget = new views::Widget; |
| 84 views::Widget::InitParams params( | 84 views::Widget::InitParams params( |
| 85 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 85 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 86 gfx::Size ps = lock_view->GetPreferredSize(); | 86 gfx::Size ps = lock_view->GetPreferredSize(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 widget->GetNativeView()->SetName("LockView"); | 98 widget->GetNativeView()->SetName("LockView"); |
| 99 widget->GetNativeView()->Focus(); | 99 widget->GetNativeView()->Focus(); |
| 100 | 100 |
| 101 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. | 101 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. |
| 102 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( | 102 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( |
| 103 widget->GetNativeView()); | 103 widget->GetNativeView()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace shell | 106 } // namespace shell |
| 107 } // namespace ash | 107 } // namespace ash |
| OLD | NEW |