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

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

Issue 1194053003: Close tray bubble before disabling UI for sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment. Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 tray->SetVisible(visible); 341 tray->SetVisible(visible);
342 tray->GetWidget()->Show(); 342 tray->GetWidget()->Show();
343 } else { 343 } else {
344 tray->GetWidget()->Hide(); 344 tray->GetWidget()->Hide();
345 } 345 }
346 } 346 }
347 } 347 }
348 348
349 void WebUILoginView::SetUIEnabled(bool enabled) { 349 void WebUILoginView::SetUIEnabled(bool enabled) {
350 forward_keyboard_event_ = enabled; 350 forward_keyboard_event_ = enabled;
351 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); 351 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
352
353 // We disable the UI to prevent user from interracting with UI elements,
354 // particullary with the system tray menu. However, in case if the system tray
355 // bubble is opened at this point, it remains opened and interactictive even
356 // after SystemTray::SetEnabled(false) call, which can be dangerous
357 // (http://crbug.com/497080). Close the menu to fix it. Calling
358 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened
359 // until the UI is enabled again.
360 if (!enabled && tray->HasSystemBubble())
361 tray->CloseSystemBubble();
362
363 tray->SetEnabled(enabled);
352 } 364 }
353 365
354 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) { 366 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) {
355 DCHECK(frame_observer); 367 DCHECK(frame_observer);
356 DCHECK(!frame_observer_list_.HasObserver(frame_observer)); 368 DCHECK(!frame_observer_list_.HasObserver(frame_observer));
357 frame_observer_list_.AddObserver(frame_observer); 369 frame_observer_list_.AddObserver(frame_observer);
358 } 370 }
359 371
360 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) { 372 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) {
361 DCHECK(frame_observer); 373 DCHECK(frame_observer);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 webui_visible_ = true; 526 webui_visible_ = true;
515 } 527 }
516 528
517 void WebUILoginView::ReturnFocus(bool reverse) { 529 void WebUILoginView::ReturnFocus(bool reverse) {
518 // Return the focus to the web contents. 530 // Return the focus to the web contents.
519 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); 531 webui_login_->web_contents()->FocusThroughTabTraversal(reverse);
520 GetWidget()->Activate(); 532 GetWidget()->Activate();
521 } 533 }
522 534
523 } // namespace chromeos 535 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698