OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
10 #include "ui/views/widget/widget_delegate.h" | 10 #include "ui/views/widget/widget_delegate.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class View; | 13 class View; |
14 class Widget; | 14 class Widget; |
15 } | 15 } |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // Shows the widget for the WebUI screen locker. | 19 // Shows the widget for the WebUI screen locker. |
20 class LockWindow : public views::Widget, public views::WidgetDelegate { | 20 class LockWindow : public views::Widget, public views::WidgetDelegate { |
21 public: | 21 public: |
22 // This class provides an interface for the lock window to notify an observer | |
23 // about its status. | |
24 class Observer { | |
25 public: | |
26 // This method will be called when the lock window has finished all | |
27 // initialization. | |
28 virtual void OnLockWindowReady() = 0; | |
29 }; | |
30 | |
31 LockWindow(); | 22 LockWindow(); |
32 ~LockWindow() override; | 23 ~LockWindow() override; |
33 | 24 |
34 // Attempt to grab inputs on the webview, the actual view displaying the lock | |
35 // screen WebView. | |
36 void Grab(); | |
37 | |
38 // Sets the observer class which is notified on lock window events. | |
39 void set_observer(Observer* observer) { observer_ = observer; } | |
40 | |
41 // Sets the view which should be initially focused. | 25 // Sets the view which should be initially focused. |
42 void set_initially_focused_view(views::View* view) { | 26 void set_initially_focused_view(views::View* view) { |
43 initially_focused_view_ = view; | 27 initially_focused_view_ = view; |
44 } | 28 } |
45 | 29 |
| 30 private: |
46 // views::WidgetDelegate: | 31 // views::WidgetDelegate: |
| 32 views::View* GetInitiallyFocusedView() override; |
47 views::Widget* GetWidget() override; | 33 views::Widget* GetWidget() override; |
48 const views::Widget* GetWidget() const override; | 34 const views::Widget* GetWidget() const override; |
49 | 35 |
50 private: | |
51 // views::WidgetDelegate: | |
52 views::View* GetInitiallyFocusedView() override; | |
53 | |
54 // The observer's OnLockWindowReady method will be called when the lock | |
55 // window has finished all initialization. | |
56 Observer* observer_ = nullptr; | |
57 | |
58 // The view which should be initially focused. | 36 // The view which should be initially focused. |
59 views::View* initially_focused_view_ = nullptr; | 37 views::View* initially_focused_view_ = nullptr; |
60 | 38 |
61 DISALLOW_COPY_AND_ASSIGN(LockWindow); | 39 DISALLOW_COPY_AND_ASSIGN(LockWindow); |
62 }; | 40 }; |
63 | 41 |
64 } // namespace chromeos | 42 } // namespace chromeos |
65 | 43 |
66 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ | 44 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOCK_WINDOW_H_ |
OLD | NEW |