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/cros/cros_library.h" | |
oshima
2011/05/18 18:24:54
do you need this?
rharrison
2011/05/19 00:31:43
nope
| |
10 #include "chrome/browser/chromeos/login/login_html_dialog.h" | |
11 #include "chrome/browser/chromeos/status/status_area_host.h" | |
12 #include "content/common/notification_observer.h" | |
13 #include "content/common/notification_registrar.h" | |
14 #include "views/focus/focus_manager.h" | |
15 #include "views/view.h" | |
16 | |
17 class DOMView; | |
18 class GURL; | |
19 class KeyboardContainerView; | |
20 class NotificationDetails; | |
21 class NotificationSource; | |
22 class Profile; | |
23 | |
24 namespace views { | |
25 class Widget; | |
26 class WindowDelegate; | |
27 } | |
28 | |
29 namespace chromeos { | |
30 | |
31 class StatusAreaView; | |
32 | |
33 // View used to render the webui login during login. WebUILoginView contains | |
34 // StatusAreaView. | |
35 class WebUILoginView : public views::View, | |
Nikita (slow)
2011/05/18 20:22:12
Seems that we'll be reusing it later for OOBE/Scre
rharrison
2011/05/19 00:31:43
Done.
| |
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. It backgroun_url is given (non empty), | |
Nikita (slow)
2011/05/18 20:22:12
nit: It > if
nit: backgroun_url ?
Should it be |lo
rharrison
2011/05/19 00:31:43
Done.
| |
53 // it creates a DOMView webui login area that renders a webpage. | |
54 void Init(const GURL& login_url); | |
55 | |
56 // Creates a window containing an instance of WizardContentsView as the root | |
Nikita (slow)
2011/05/18 20:22:12
nit: WizardContentsView > WebUILoginView
rharrison
2011/05/19 00:31:43
Done.
| |
57 // view. The caller is responsible for showing (and closing) the returned | |
58 // widget. The WebUILoginView is set in |view|. If webui login_url is non | |
Nikita (slow)
2011/05/18 20:22:12
nit: |login_url|
rharrison
2011/05/19 00:31:43
Done.
| |
59 // empty, the content page of the url is displayed as a webui login. | |
60 static views::Widget* CreateWindowContainingView( | |
61 const gfx::Rect& bounds, | |
62 const GURL& login_url, | |
63 WebUILoginView** view); | |
64 | |
65 // Overriden from Views. | |
Ben Goodger (Google)
2011/05/18 16:50:51
nit: // Overridden from views::View:
rharrison
2011/05/19 00:31:43
Done.
| |
66 virtual std::string GetClassName() const OVERRIDE; | |
67 | |
68 // Overridden from StatusAreaHost: | |
69 virtual gfx::NativeWindow GetNativeWindow() const; | |
70 | |
71 // views::FocusChangeListener implementation | |
Ben Goodger (Google)
2011/05/18 16:50:51
nit: Overridden from views::FocusChangeListener:
rharrison
2011/05/19 00:31:43
Done.
| |
72 virtual void FocusWillChange(views::View* focused_before, | |
73 views::View* focused_now); | |
74 | |
75 // Toggles status area visibility. | |
Ben Goodger (Google)
2011/05/18 16:50:51
nit: move these public setters above the interface
rharrison
2011/05/19 00:31:43
Removed them since I don't actually use them.
| |
76 void SetStatusAreaVisible(bool visible); | |
77 // Toggles whether status area is enabled. | |
78 void SetStatusAreaEnabled(bool enable); | |
79 | |
80 protected: | |
81 // Overridden from views::View: | |
82 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
83 virtual void Layout() OVERRIDE; | |
84 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | |
85 | |
86 // Overridden from StatusAreaHost: | |
87 virtual Profile* GetProfile() const OVERRIDE { return NULL; } | |
Nikita (slow)
2011/05/18 20:22:12
Please move to the .cc file since it's a virtual f
rharrison
2011/05/19 00:31:43
Done.
| |
88 virtual void ExecuteBrowserCommand(int id) const OVERRIDE {} | |
89 virtual bool ShouldOpenButtonOptions( | |
90 const views::View* button_view) const OVERRIDE; | |
91 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; | |
92 virtual ScreenMode GetScreenMode() const OVERRIDE; | |
93 virtual TextStyle GetTextStyle() const OVERRIDE; | |
94 | |
95 // Overridden from LoginHtmlDialog::Delegate: | |
96 virtual void OnDialogClosed() OVERRIDE {} | |
97 virtual void OnLocaleChanged() OVERRIDE; | |
98 | |
99 private: | |
100 // Creates and adds the status_area. | |
101 void InitStatusArea(); | |
102 | |
103 // Invokes SetWindowType for the window. This is invoked during startup and | |
104 // after we've painted. | |
105 void UpdateWindowType(); | |
106 | |
107 virtual void InitVirtualKeyboard(); | |
Ben Goodger (Google)
2011/05/18 16:50:51
Why would someone override these? (I see they're v
rharrison
2011/05/19 00:31:43
We don't need to override them. That was an artifa
| |
108 virtual void UpdateKeyboardAndLayout(bool should_show_keyboard); | |
109 virtual VirtualKeyboardType DecideKeyboardStateForView(views::View* view); | |
110 | |
111 // Overridden from NotificationObserver. | |
Nikita (slow)
2011/05/18 20:22:12
nit: indent
rharrison
2011/05/19 00:31:43
Done.
| |
112 virtual void Observe(NotificationType type, | |
113 const NotificationSource& source, | |
114 const NotificationDetails& details); | |
115 | |
116 Profile* profile_; | |
117 | |
118 StatusAreaView* status_area_; | |
119 | |
120 // Has Paint been invoked once? The value of this is passed to the window | |
121 // manager. | |
122 // TODO(sky): nuke this when the wm knows when chrome has painted. | |
123 bool did_paint_; | |
oshima
2011/05/18 18:24:54
do we still need this?
rharrison
2011/05/19 00:31:43
I do not know. I left it in since it was in the co
| |
124 | |
125 // DOMView for rendering a webpage as a webui login. | |
126 DOMView* webui_login_; | |
127 | |
128 // Proxy settings dialog that can be invoked from network menu. | |
129 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; | |
130 | |
131 bool keyboard_showing_; | |
132 bool focus_listener_added_; | |
133 KeyboardContainerView* keyboard_; | |
134 NotificationRegistrar registrar_; | |
135 | |
136 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); | |
137 }; | |
138 | |
139 } // namespace chromeos | |
140 | |
141 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | |
OLD | NEW |