OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include "chrome/browser/chromeos/login/login_html_dialog.h" | |
10 #include "chrome/browser/chromeos/status/status_area_host.h" | |
11 #include "content/common/notification_observer.h" | |
12 #include "content/common/notification_registrar.h" | |
13 #include "views/focus/focus_manager.h" | |
14 #include "views/view.h" | |
15 | |
16 class DOMView; | |
17 class GURL; | |
18 class KeyboardContainerView; | |
19 class NotificationDetails; | |
20 class NotificationSource; | |
21 class Profile; | |
22 | |
23 namespace views { | |
24 class Widget; | |
25 class WindowDelegate; | |
26 } | |
27 | |
28 namespace chromeos { | |
29 | |
30 class StatusAreaView; | |
31 | |
32 // View used to render a WebUI supporting Widget. This widget is used for the | |
33 // WebUI based start up and lock screens. It contains a StatusAreaView, DOMView, | |
34 // and on touch builds a KeyboardContainerView. | |
35 class WebUILoginView : public views::View, | |
36 public StatusAreaHost, | |
37 public chromeos::LoginHtmlDialog::Delegate, | |
38 public views::FocusChangeListener, | |
39 public NotificationObserver { | |
40 public: | |
41 enum VirtualKeyboardType { | |
42 NONE, | |
43 GENERIC, | |
44 URL, | |
45 }; | |
46 | |
47 // Internal class name. | |
48 static const char kViewClassName[]; | |
49 | |
50 WebUILoginView(); | |
51 | |
52 // Initializes the webui login view. |login_url| must be specified. | |
53 void Init(const GURL& login_url); | |
54 | |
55 // Creates a window containing an instance of WebUILoginView as the root | |
56 // view. The caller is responsible for showing (and closing) the returned | |
57 // widget. The WebUILoginView is set in |view|. |login_url| is the webpage | |
58 // that will be opened in the DOMView. | |
59 static views::Widget* CreateWindowContainingView( | |
60 const gfx::Rect& bounds, | |
61 const GURL& login_url, | |
62 WebUILoginView** view); | |
63 | |
64 // Overriden from views::Views: | |
65 virtual std::string GetClassName() const OVERRIDE; | |
66 | |
67 // Overridden from StatusAreaHost: | |
68 virtual gfx::NativeWindow GetNativeWindow() const; | |
69 | |
70 // Overridden from views::FocusChangeListener: | |
71 virtual void FocusWillChange(views::View* focused_before, | |
72 views::View* focused_now); | |
73 | |
74 protected: | |
75 // Overridden from views::View: | |
76 virtual void Layout() OVERRIDE; | |
77 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | |
78 | |
79 // Overridden from StatusAreaHost: | |
80 virtual Profile* GetProfile() const OVERRIDE; | |
81 virtual void ExecuteBrowserCommand(int id) const OVERRIDE; | |
82 virtual bool ShouldOpenButtonOptions( | |
83 const views::View* button_view) const OVERRIDE; | |
84 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; | |
85 virtual ScreenMode GetScreenMode() const OVERRIDE; | |
86 virtual TextStyle GetTextStyle() const OVERRIDE; | |
87 | |
88 // Overridden from LoginHtmlDialog::Delegate: | |
89 virtual void OnDialogClosed() OVERRIDE; | |
90 virtual void OnLocaleChanged() OVERRIDE; | |
91 | |
92 private: | |
93 // Creates and adds the status_area. | |
94 void InitStatusArea(); | |
95 | |
96 // Invokes SetWindowType for the window. This is invoked during startup and | |
97 // after we've painted. | |
98 void UpdateWindowType(); | |
99 | |
100 void InitVirtualKeyboard(); | |
101 void UpdateKeyboardAndLayout(bool should_show_keyboard); | |
102 VirtualKeyboardType DecideKeyboardStateForView(views::View* view); | |
103 | |
104 // Overridden from NotificationObserver. | |
105 virtual void Observe(NotificationType type, | |
sky
2011/05/23 15:16:39
OVERRIDE
rharrison
2011/05/25 02:58:55
Done.
| |
106 const NotificationSource& source, | |
107 const NotificationDetails& details); | |
108 | |
109 Profile* profile_; | |
110 | |
111 StatusAreaView* status_area_; | |
112 | |
113 // DOMView for rendering a webpage as a webui login. | |
114 DOMView* webui_login_; | |
115 | |
116 // Proxy settings dialog that can be invoked from network menu. | |
117 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; | |
118 | |
119 bool keyboard_showing_; | |
120 bool focus_listener_added_; | |
121 KeyboardContainerView* keyboard_; | |
122 NotificationRegistrar registrar_; | |
123 | |
124 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); | |
125 }; | |
126 | |
127 } // namespace chromeos | |
128 | |
129 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | |
OLD | NEW |