| 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/common/system/user/user_view.h" | 5 #include "ash/common/system/user/user_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (UseMd()) { | 566 if (UseMd()) { |
| 567 // Position the widget on top of the user card view (which is still in the | 567 // Position the widget on top of the user card view (which is still in the |
| 568 // system menu). The top half of the widget will be transparent to allow | 568 // system menu). The top half of the widget will be transparent to allow |
| 569 // the active user to show through. | 569 // the active user to show through. |
| 570 gfx::Rect bounds = user_card_view_->GetBoundsInScreen(); | 570 gfx::Rect bounds = user_card_view_->GetBoundsInScreen(); |
| 571 bounds.set_width(bounds.width() + kSeparatorWidth); | 571 bounds.set_width(bounds.width() + kSeparatorWidth); |
| 572 int row_height = bounds.height(); | 572 int row_height = bounds.height(); |
| 573 bounds.set_height(row_height * 2); | 573 bounds.set_height(row_height * 2); |
| 574 add_menu_option_->SetBounds(bounds); | 574 add_menu_option_->SetBounds(bounds); |
| 575 | 575 |
| 576 // This nested container is necessary to stack borders. | |
| 577 views::View* nested_container = new views::View(); | |
| 578 nested_container->SetBorder( | |
| 579 views::Border::CreateEmptyBorder(row_height, 0, 0, 0)); | |
| 580 nested_container->SetLayoutManager(new views::FillLayout()); | |
| 581 nested_container->AddChildView(button); | |
| 582 | |
| 583 views::View* container = new AddUserWidgetContents( | 576 views::View* container = new AddUserWidgetContents( |
| 584 base::Bind(&UserView::RemoveAddUserMenuOption, base::Unretained(this))); | 577 base::Bind(&UserView::RemoveAddUserMenuOption, base::Unretained(this))); |
| 585 container->SetBorder(views::Border::CreateSolidSidedBorder( | 578 container->SetBorder(views::Border::AddInteriorPadding( |
| 586 0, 0, 0, kSeparatorWidth, kBackgroundColor)); | 579 views::Border::CreateSolidSidedBorder(0, 0, 0, kSeparatorWidth, |
| 580 kBackgroundColor), |
| 581 gfx::Insets(row_height, 0, 0, 0))); |
| 587 container->SetLayoutManager(new views::FillLayout()); | 582 container->SetLayoutManager(new views::FillLayout()); |
| 588 container->AddChildView(nested_container); | 583 container->AddChildView(button); |
| 589 add_menu_option_->SetContentsView(container); | 584 add_menu_option_->SetContentsView(container); |
| 590 } else { | 585 } else { |
| 591 add_menu_option_->SetOpacity(1.f); | 586 add_menu_option_->SetOpacity(1.f); |
| 592 add_menu_option_->SetContentsView(button); | 587 add_menu_option_->SetContentsView(button); |
| 593 // Position it below our user card. | 588 // Position it below our user card. |
| 594 gfx::Rect bounds = user_card_view_->GetBoundsInScreen(); | 589 gfx::Rect bounds = user_card_view_->GetBoundsInScreen(); |
| 595 bounds.set_y(bounds.y() + bounds.height()); | 590 bounds.set_y(bounds.y() + bounds.height()); |
| 596 add_menu_option_->SetBounds(bounds); | 591 add_menu_option_->SetBounds(bounds); |
| 597 } | 592 } |
| 598 | 593 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 focus_manager_ = nullptr; | 648 focus_manager_ = nullptr; |
| 654 if (user_card_view_->GetFocusManager()) | 649 if (user_card_view_->GetFocusManager()) |
| 655 user_card_view_->GetFocusManager()->ClearFocus(); | 650 user_card_view_->GetFocusManager()->ClearFocus(); |
| 656 popup_message_.reset(); | 651 popup_message_.reset(); |
| 657 mouse_watcher_.reset(); | 652 mouse_watcher_.reset(); |
| 658 add_menu_option_.reset(); | 653 add_menu_option_.reset(); |
| 659 } | 654 } |
| 660 | 655 |
| 661 } // namespace tray | 656 } // namespace tray |
| 662 } // namespace ash | 657 } // namespace ash |
| OLD | NEW |