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 "chrome/browser/chromeos/login/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/webui_login_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 namespace chromeos { | 111 namespace chromeos { |
112 | 112 |
113 // WebUILoginView public: ------------------------------------------------------ | 113 // WebUILoginView public: ------------------------------------------------------ |
114 | 114 |
115 WebUILoginView::WebUILoginView() | 115 WebUILoginView::WebUILoginView() |
116 : webui_login_(NULL), | 116 : webui_login_(NULL), |
117 login_window_(NULL), | 117 login_window_(NULL), |
118 host_window_frozen_(false), | 118 host_window_frozen_(false), |
119 is_hidden_(false), | 119 is_hidden_(false), |
120 login_visible_notification_fired_(false), | |
121 login_prompt_visible_handled_(false), | 120 login_prompt_visible_handled_(false), |
122 should_emit_login_prompt_visible_(true) { | 121 should_emit_login_prompt_visible_(true) { |
123 registrar_.Add(this, | 122 registrar_.Add(this, |
124 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, | 123 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, |
125 content::NotificationService::AllSources()); | 124 content::NotificationService::AllSources()); |
126 | 125 |
127 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] = | 126 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] = |
128 kAccelNameCancel; | 127 kAccelNameCancel; |
129 accel_map_[ui::Accelerator(ui::VKEY_E, | 128 accel_map_[ui::Accelerator(ui::VKEY_E, |
130 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = | 129 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 231 } |
233 | 232 |
234 void WebUILoginView::OpenProxySettings() { | 233 void WebUILoginView::OpenProxySettings() { |
235 ProxySettingsDialog* dialog = | 234 ProxySettingsDialog* dialog = |
236 new ProxySettingsDialog(NULL, GetNativeWindow()); | 235 new ProxySettingsDialog(NULL, GetNativeWindow()); |
237 dialog->Show(); | 236 dialog->Show(); |
238 } | 237 } |
239 | 238 |
240 void WebUILoginView::OnPostponedShow() { | 239 void WebUILoginView::OnPostponedShow() { |
241 set_is_hidden(false); | 240 set_is_hidden(false); |
242 // If notification will happen later let it fire login-prompt-visible signal. | 241 OnLoginPromptVisible(); |
243 if (login_visible_notification_fired_) { | |
244 LOG(INFO) << "Login WebUI >> postponed show, login_visible already fired"; | |
245 OnLoginPromptVisible(); | |
246 } | |
247 } | 242 } |
248 | 243 |
249 void WebUILoginView::SetStatusAreaVisible(bool visible) { | 244 void WebUILoginView::SetStatusAreaVisible(bool visible) { |
250 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); | 245 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); |
251 if (tray) { | 246 if (tray) { |
252 if (visible) { | 247 if (visible) { |
253 // Tray may have been initialized being hidden. | 248 // Tray may have been initialized being hidden. |
254 tray->SetVisible(visible); | 249 tray->SetVisible(visible); |
255 tray->GetWidget()->Show(); | 250 tray->GetWidget()->Show(); |
256 } else { | 251 } else { |
(...skipping 21 matching lines...) Expand all Loading... |
278 // Return the focus to the web contents. | 273 // Return the focus to the web contents. |
279 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 274 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
280 GetWidget()->Activate(); | 275 GetWidget()->Activate(); |
281 } | 276 } |
282 | 277 |
283 void WebUILoginView::Observe(int type, | 278 void WebUILoginView::Observe(int type, |
284 const content::NotificationSource& source, | 279 const content::NotificationSource& source, |
285 const content::NotificationDetails& details) { | 280 const content::NotificationDetails& details) { |
286 switch (type) { | 281 switch (type) { |
287 case chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE: { | 282 case chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE: { |
288 login_visible_notification_fired_ = true; | |
289 OnLoginPromptVisible(); | 283 OnLoginPromptVisible(); |
290 registrar_.RemoveAll(); | 284 registrar_.RemoveAll(); |
291 break; | 285 break; |
292 } | 286 } |
293 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { | 287 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
294 RenderViewHost* render_view_host = | 288 RenderViewHost* render_view_host = |
295 content::Details<RenderViewHost>(details).ptr(); | 289 content::Details<RenderViewHost>(details).ptr(); |
296 new SnifferObserver(render_view_host, GetWebUI()); | 290 new SnifferObserver(render_view_host, GetWebUI()); |
297 break; | 291 break; |
298 } | 292 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 aura::Env::GetInstance()->set_render_white_bg(true); | 370 aura::Env::GetInstance()->set_render_white_bg(true); |
377 } | 371 } |
378 | 372 |
379 void WebUILoginView::ReturnFocus(bool reverse) { | 373 void WebUILoginView::ReturnFocus(bool reverse) { |
380 // Return the focus to the web contents. | 374 // Return the focus to the web contents. |
381 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 375 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
382 GetWidget()->Activate(); | 376 GetWidget()->Activate(); |
383 } | 377 } |
384 | 378 |
385 } // namespace chromeos | 379 } // namespace chromeos |
OLD | NEW |