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

Side by Side Diff: ash/system/user/user_view.cc

Issue 1963563002: Views: Flip default value of CustomButton::request_focus_on_press_ to false. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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 "ash/system/user/user_view.h" 5 #include "ash/system/user/user_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 contents_view->SetBorder(views::Border::CreateEmptyBorder( 398 contents_view->SetBorder(views::Border::CreateEmptyBorder(
399 kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal, 399 kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal,
400 kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal)); 400 kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal));
401 contents_view->SetLayoutManager(new views::FillLayout()); 401 contents_view->SetLayoutManager(new views::FillLayout());
402 SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 0)); 402 SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 0));
403 contents_view->AddChildView(user_card_view_); 403 contents_view->AddChildView(user_card_view_);
404 insets = gfx::Insets(1, 1, 1, 3); 404 insets = gfx::Insets(1, 1, 1, 3);
405 } 405 }
406 auto* button = 406 auto* button =
407 new ButtonFromView(contents_view, this, !user_index_, insets); 407 new ButtonFromView(contents_view, this, !user_index_, insets);
408 // A click on the button should not trigger a focus change.
409 button->set_request_focus_on_press(false);
410 user_card_view_ = button; 408 user_card_view_ = button;
411 is_user_card_button_ = true; 409 is_user_card_button_ = true;
412 } 410 }
413 AddChildViewAt(user_card_view_, 0); 411 AddChildViewAt(user_card_view_, 0);
414 // Card for supervised user can consume more space than currently 412 // Card for supervised user can consume more space than currently
415 // available. In that case we should increase system bubble's width. 413 // available. In that case we should increase system bubble's width.
416 if (login == user::LOGGED_IN_PUBLIC) 414 if (login == user::LOGGED_IN_PUBLIC)
417 bubble_view->SetWidth(GetPreferredSize().width()); 415 bubble_view->SetWidth(GetPreferredSize().width());
418 } 416 }
419 417
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const SessionStateDelegate* delegate = 452 const SessionStateDelegate* delegate =
455 Shell::GetInstance()->session_state_delegate(); 453 Shell::GetInstance()->session_state_delegate();
456 454
457 SessionStateDelegate::AddUserError add_user_error; 455 SessionStateDelegate::AddUserError add_user_error;
458 add_user_enabled_ = delegate->CanAddUserToMultiProfile(&add_user_error); 456 add_user_enabled_ = delegate->CanAddUserToMultiProfile(&add_user_error);
459 457
460 ButtonFromView* button = new ButtonFromView(add_user_view, 458 ButtonFromView* button = new ButtonFromView(add_user_view,
461 add_user_enabled_ ? this : NULL, 459 add_user_enabled_ ? this : NULL,
462 add_user_enabled_, 460 add_user_enabled_,
463 gfx::Insets(1, 1, 1, 1)); 461 gfx::Insets(1, 1, 1, 1));
464 button->set_request_focus_on_press(false);
465 button->SetAccessibleName( 462 button->SetAccessibleName(
466 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT)); 463 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT));
467 button->ForceBorderVisible(true); 464 button->ForceBorderVisible(true);
468 add_menu_option_->SetContentsView(button); 465 add_menu_option_->SetContentsView(button);
469 466
470 if (add_user_enabled_) { 467 if (add_user_enabled_) {
471 // We activate the entry automatically if invoked with focus. 468 // We activate the entry automatically if invoked with focus.
472 if (user_card_view_->HasFocus()) { 469 if (user_card_view_->HasFocus()) {
473 button->GetFocusManager()->SetFocusedView(button); 470 button->GetFocusManager()->SetFocusedView(button);
474 user_card_view_->GetFocusManager()->SetFocusedView(button); 471 user_card_view_->GetFocusManager()->SetFocusedView(button);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 focus_manager_ = NULL; 517 focus_manager_ = NULL;
521 if (user_card_view_->GetFocusManager()) 518 if (user_card_view_->GetFocusManager())
522 user_card_view_->GetFocusManager()->ClearFocus(); 519 user_card_view_->GetFocusManager()->ClearFocus();
523 popup_message_.reset(); 520 popup_message_.reset();
524 mouse_watcher_.reset(); 521 mouse_watcher_.reset();
525 add_menu_option_.reset(); 522 add_menu_option_.reset();
526 } 523 }
527 524
528 } // namespace tray 525 } // namespace tray
529 } // namespace ash 526 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_popup_label_button.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698