| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Give the logout button the space it requests. | 276 // Give the logout button the space it requests. |
| 277 gfx::Rect logout_area = contents_area; | 277 gfx::Rect logout_area = contents_area; |
| 278 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize()); | 278 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize()); |
| 279 logout_area.set_x(contents_area.right() - logout_area.width()); | 279 logout_area.set_x(contents_area.right() - logout_area.width()); |
| 280 | 280 |
| 281 // Give the remaining space to the user card. | 281 // Give the remaining space to the user card. |
| 282 gfx::Rect user_card_area = contents_area; | 282 gfx::Rect user_card_area = contents_area; |
| 283 int remaining_width = contents_area.width() - logout_area.width(); | 283 int remaining_width = contents_area.width() - logout_area.width(); |
| 284 if (IsMultiProfileSupportedAndUserActive() || | 284 if (IsMultiProfileSupportedAndUserActive() || |
| 285 IsMultiAccountSupportedAndUserActive()) { | 285 IsMultiAccountSupportedAndUserActive()) { |
| 286 // In multiprofile case |user_card_view_| and |logout_button_| have to | 286 // In multiprofile/multiaccount case |user_card_view_| and |
| 287 // have the same height. | 287 // |logout_button_| have to have the same height. |
| 288 int y = std::min(user_card_area.y(), logout_area.y()); | 288 int y = std::min(user_card_area.y(), logout_area.y()); |
| 289 int height = std::max(user_card_area.height(), logout_area.height()); | 289 int height = std::max(user_card_area.height(), logout_area.height()); |
| 290 logout_area.set_y(y); | 290 logout_area.set_y(y); |
| 291 logout_area.set_height(height); | 291 logout_area.set_height(height); |
| 292 user_card_area.set_y(y); | 292 user_card_area.set_y(y); |
| 293 user_card_area.set_height(height); | 293 user_card_area.set_height(height); |
| 294 | 294 |
| 295 // In multiprofile mode we have also to increase the size of the card by | 295 // In multiprofile mode we have also to increase the size of the card by |
| 296 // the size of the border to make it overlap with the logout button. | 296 // the size of the border to make it overlap with the logout button. |
| 297 user_card_area.set_width(std::max(0, remaining_width + 1)); | 297 user_card_area.set_width(std::max(0, remaining_width + 1)); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // watcher which will close the "menu". | 482 // watcher which will close the "menu". |
| 483 gfx::Rect area = user_card_view_->GetBoundsInScreen(); | 483 gfx::Rect area = user_card_view_->GetBoundsInScreen(); |
| 484 area.set_height(2 * area.height()); | 484 area.set_height(2 * area.height()); |
| 485 mouse_watcher_.reset( | 485 mouse_watcher_.reset( |
| 486 new views::MouseWatcher(new UserViewMouseWatcherHost(area), this)); | 486 new views::MouseWatcher(new UserViewMouseWatcherHost(area), this)); |
| 487 mouse_watcher_->Start(); | 487 mouse_watcher_->Start(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace tray | 490 } // namespace tray |
| 491 } // namespace ash | 491 } // namespace ash |
| OLD | NEW |