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/md_text_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 views::MdTextButton::CreateMdButton(this, | 30 views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock"))) { |
31 base::ASCIIToUTF16("Unlock"))) { | |
32 AddChildView(unlock_button_); | 31 AddChildView(unlock_button_); |
33 } | 32 } |
34 ~LockView() override {} | 33 ~LockView() override {} |
35 | 34 |
36 // Overridden from views::View: | 35 // Overridden from views::View: |
37 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); } | 36 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); } |
38 | 37 |
39 private: | 38 private: |
40 // Overridden from views::View: | 39 // Overridden from views::View: |
41 void OnPaint(gfx::Canvas* canvas) override { | 40 void OnPaint(gfx::Canvas* canvas) override { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 widget->GetNativeView()->SetName("LockView"); | 97 widget->GetNativeView()->SetName("LockView"); |
99 widget->GetNativeView()->Focus(); | 98 widget->GetNativeView()->Focus(); |
100 | 99 |
101 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. | 100 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. |
102 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( | 101 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( |
103 widget->GetNativeView()); | 102 widget->GetNativeView()); |
104 } | 103 } |
105 | 104 |
106 } // namespace shell | 105 } // namespace shell |
107 } // namespace ash | 106 } // namespace ash |
OLD | NEW |