Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: chrome/browser/chromeos/login/ui/webui_login_view.cc

Issue 2429033003: cros: Cleanup lock screen and OOBE C++ backing code. (Closed)
Patch Set: Address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 5 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
6 6
7 #include "ash/common/focus_cycler.h" 7 #include "ash/common/focus_cycler.h"
8 #include "ash/common/system/status_area_widget_delegate.h" 8 #include "ash/common/system/status_area_widget_delegate.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 private: 166 private:
167 WebUILoginView* const webui_login_view_; 167 WebUILoginView* const webui_login_view_;
168 views::FocusSearch status_area_focus_search_; 168 views::FocusSearch status_area_focus_search_;
169 169
170 DISALLOW_COPY_AND_ASSIGN(StatusAreaFocusTraversable); 170 DISALLOW_COPY_AND_ASSIGN(StatusAreaFocusTraversable);
171 }; 171 };
172 172
173 // WebUILoginView public: ------------------------------------------------------ 173 // WebUILoginView public: ------------------------------------------------------
174 174
175 WebUILoginView::WebUILoginView() 175 WebUILoginView::WebUILoginView() {
176 : webui_login_(NULL),
177 is_hidden_(false),
178 webui_visible_(false),
179 should_emit_login_prompt_visible_(true),
180 forward_keyboard_event_(true) {
181 registrar_.Add(this, 176 registrar_.Add(this,
182 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, 177 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
183 content::NotificationService::AllSources()); 178 content::NotificationService::AllSources());
184 registrar_.Add(this, 179 registrar_.Add(this,
185 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, 180 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN,
186 content::NotificationService::AllSources()); 181 content::NotificationService::AllSources());
187 182
188 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] = 183 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] =
189 kAccelNameCancel; 184 kAccelNameCancel;
190 accel_map_[ui::Accelerator(ui::VKEY_E, 185 accel_map_[ui::Accelerator(ui::VKEY_E,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 369 }
375 370
376 content::WebUI* WebUILoginView::GetWebUI() { 371 content::WebUI* WebUILoginView::GetWebUI() {
377 return webui_login_->web_contents()->GetWebUI(); 372 return webui_login_->web_contents()->GetWebUI();
378 } 373 }
379 374
380 content::WebContents* WebUILoginView::GetWebContents() { 375 content::WebContents* WebUILoginView::GetWebContents() {
381 return webui_login_->web_contents(); 376 return webui_login_->web_contents();
382 } 377 }
383 378
379 OobeUI* WebUILoginView::GetOobeUI() {
380 return static_cast<OobeUI*>(GetWebUI()->GetController());
381 }
382
384 void WebUILoginView::OpenProxySettings() { 383 void WebUILoginView::OpenProxySettings() {
385 const NetworkState* network = 384 const NetworkState* network =
386 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); 385 NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
387 if (!network) { 386 if (!network) {
388 LOG(ERROR) << "No default network found!"; 387 LOG(ERROR) << "No default network found!";
389 return; 388 return;
390 } 389 }
391 ProxySettingsDialog* dialog = 390 ProxySettingsDialog* dialog =
392 new ProxySettingsDialog(ProfileHelper::GetSigninProfile(), 391 new ProxySettingsDialog(ProfileHelper::GetSigninProfile(),
393 *network, NULL, GetNativeWindow()); 392 *network, NULL, GetNativeWindow());
(...skipping 24 matching lines...) Expand all
418 void WebUILoginView::SetUIEnabled(bool enabled) { 417 void WebUILoginView::SetUIEnabled(bool enabled) {
419 forward_keyboard_event_ = enabled; 418 forward_keyboard_event_ = enabled;
420 if (chrome::IsRunningInMash()) { 419 if (chrome::IsRunningInMash()) {
421 NOTIMPLEMENTED(); 420 NOTIMPLEMENTED();
422 return; 421 return;
423 } 422 }
424 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 423 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
425 424
426 // We disable the UI to prevent user from interracting with UI elements, 425 // We disable the UI to prevent user from interracting with UI elements,
427 // particullary with the system tray menu. However, in case if the system tray 426 // particullary with the system tray menu. However, in case if the system tray
428 // bubble is opened at this point, it remains opened and interactictive even 427 // bubble is opened at this point, it remains opened and interactive even
429 // after SystemTray::SetEnabled(false) call, which can be dangerous 428 // after SystemTray::SetEnabled(false) call, which can be dangerous
430 // (http://crbug.com/497080). Close the menu to fix it. Calling 429 // (http://crbug.com/497080). Close the menu to fix it. Calling
431 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened 430 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened
432 // until the UI is enabled again. 431 // until the UI is enabled again.
433 if (!enabled && tray->HasSystemBubble()) 432 if (!enabled && tray->HasSystemBubble())
434 tray->CloseSystemBubble(); 433 tray->CloseSystemBubble();
435 434
436 tray->SetEnabled(enabled); 435 tray->SetEnabled(enabled);
437 } 436 }
438 437
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 event.type == blink::WebGestureEvent::GesturePinchUpdate || 597 event.type == blink::WebGestureEvent::GesturePinchUpdate ||
599 event.type == blink::WebGestureEvent::GesturePinchEnd; 598 event.type == blink::WebGestureEvent::GesturePinchEnd;
600 } 599 }
601 600
602 void WebUILoginView::OnLoginPromptVisible() { 601 void WebUILoginView::OnLoginPromptVisible() {
603 // If we're hidden than will generate this signal once we're shown. 602 // If we're hidden than will generate this signal once we're shown.
604 if (is_hidden_ || webui_visible_) { 603 if (is_hidden_ || webui_visible_) {
605 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; 604 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_;
606 return; 605 return;
607 } 606 }
608 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromoptVisible"); 607 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromptVisible");
609 if (should_emit_login_prompt_visible_) { 608 if (should_emit_login_prompt_visible_) {
610 VLOG(1) << "Login WebUI >> login-prompt-visible"; 609 VLOG(1) << "Login WebUI >> login-prompt-visible";
611 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> 610 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
612 EmitLoginPromptVisible(); 611 EmitLoginPromptVisible();
613 } 612 }
614 613
615 webui_visible_ = true; 614 webui_visible_ = true;
616 } 615 }
617 616
618 } // namespace chromeos 617 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.h ('k') | chrome/browser/chromeos/power/renderer_freezer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698