OLD | NEW |
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 | 8 |
9 #include "ash/multi_profile_uma.h" | 9 #include "ash/multi_profile_uma.h" |
10 #include "ash/popup_message.h" | 10 #include "ash/popup_message.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 views::TrayBubbleView* bubble_view = | 394 views::TrayBubbleView* bubble_view = |
395 owner_->system_tray()->GetSystemBubble()->bubble_view(); | 395 owner_->system_tray()->GetSystemBubble()->bubble_view(); |
396 int max_card_width = | 396 int max_card_width = |
397 bubble_view->GetMaximumSize().width() - | 397 bubble_view->GetMaximumSize().width() - |
398 (2 * kTrayPopupPaddingHorizontal + kTrayPopupPaddingBetweenItems); | 398 (2 * kTrayPopupPaddingHorizontal + kTrayPopupPaddingBetweenItems); |
399 if (logout_button_) | 399 if (logout_button_) |
400 max_card_width -= logout_button_->GetPreferredSize().width(); | 400 max_card_width -= logout_button_->GetPreferredSize().width(); |
401 user_card_view_ = | 401 user_card_view_ = |
402 new UserCardView(login, max_card_width, multiprofile_index_); | 402 new UserCardView(login, max_card_width, multiprofile_index_); |
403 // The entry is clickable when no system modal dialog is open and one of the | 403 bool clickable = IsMultiProfileSupportedAndUserActive() || |
404 // multi user options is active. | 404 IsMultiAccountSupportedAndUserActive(); |
405 bool clickable = !Shell::GetInstance()->IsSystemModalWindowOpen() && | |
406 (IsMultiProfileSupportedAndUserActive() || | |
407 IsMultiAccountSupportedAndUserActive()); | |
408 if (clickable) { | 405 if (clickable) { |
409 // To allow the border to start before the icon, reduce the size before and | 406 // To allow the border to start before the icon, reduce the size before and |
410 // add an inset to the icon to get the spacing. | 407 // add an inset to the icon to get the spacing. |
411 if (!multiprofile_index_) { | 408 if (!multiprofile_index_) { |
412 SetBorder(views::Border::CreateEmptyBorder( | 409 SetBorder(views::Border::CreateEmptyBorder( |
413 kTrayPopupUserCardVerticalPadding, | 410 kTrayPopupUserCardVerticalPadding, |
414 kTrayPopupPaddingHorizontal - kTrayUserTileHoverBorderInset, | 411 kTrayPopupPaddingHorizontal - kTrayUserTileHoverBorderInset, |
415 kTrayPopupUserCardVerticalPadding, | 412 kTrayPopupUserCardVerticalPadding, |
416 kTrayPopupPaddingHorizontal)); | 413 kTrayPopupPaddingHorizontal)); |
417 user_card_view_->SetBorder(views::Border::CreateEmptyBorder( | 414 user_card_view_->SetBorder(views::Border::CreateEmptyBorder( |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 focus_manager_ = NULL; | 555 focus_manager_ = NULL; |
559 if (user_card_view_->GetFocusManager()) | 556 if (user_card_view_->GetFocusManager()) |
560 user_card_view_->GetFocusManager()->ClearFocus(); | 557 user_card_view_->GetFocusManager()->ClearFocus(); |
561 popup_message_.reset(); | 558 popup_message_.reset(); |
562 mouse_watcher_.reset(); | 559 mouse_watcher_.reset(); |
563 add_menu_option_.reset(); | 560 add_menu_option_.reset(); |
564 } | 561 } |
565 | 562 |
566 } // namespace tray | 563 } // namespace tray |
567 } // namespace ash | 564 } // namespace ash |
OLD | NEW |