Chromium Code Reviews| 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" |
| 11 #include "ash/common/multi_profile_uma.h" | 11 #include "ash/common/multi_profile_uma.h" |
| 12 #include "ash/common/popup_message.h" | 12 #include "ash/common/popup_message.h" |
| 13 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
| 14 #include "ash/common/shell_delegate.h" | 14 #include "ash/common/shell_delegate.h" |
| 15 #include "ash/common/system/tray/system_tray.h" | 15 #include "ash/common/system/tray/system_tray.h" |
| 16 #include "ash/common/system/tray/system_tray_delegate.h" | 16 #include "ash/common/system/tray/system_tray_delegate.h" |
| 17 #include "ash/common/system/tray/tray_constants.h" | 17 #include "ash/common/system/tray/tray_constants.h" |
| 18 #include "ash/common/system/tray/tray_popup_label_button.h" | 18 #include "ash/common/system/tray/tray_popup_label_button.h" |
| 19 #include "ash/common/system/tray/tray_popup_label_button_border.h" | 19 #include "ash/common/system/tray/tray_popup_label_button_border.h" |
| 20 #include "ash/common/system/tray/tray_utils.h" | |
| 20 #include "ash/common/system/user/button_from_view.h" | 21 #include "ash/common/system/user/button_from_view.h" |
| 21 #include "ash/common/system/user/login_status.h" | 22 #include "ash/common/system/user/login_status.h" |
| 22 #include "ash/common/system/user/rounded_image_view.h" | 23 #include "ash/common/system/user/rounded_image_view.h" |
| 23 #include "ash/common/system/user/user_card_view.h" | 24 #include "ash/common/system/user/user_card_view.h" |
| 24 #include "ash/common/wm_lookup.h" | 25 #include "ash/common/wm_lookup.h" |
| 25 #include "ash/common/wm_root_window_controller.h" | 26 #include "ash/common/wm_root_window_controller.h" |
| 26 #include "ash/common/wm_shell.h" | 27 #include "ash/common/wm_shell.h" |
| 27 #include "ash/common/wm_window.h" | 28 #include "ash/common/wm_window.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 29 #include "ash/public/cpp/shell_window_ids.h" |
| 29 #include "ash/resources/vector_icons/vector_icons.h" | 30 #include "ash/resources/vector_icons/vector_icons.h" |
| 30 #include "components/signin/core/account_id/account_id.h" | 31 #include "components/signin/core/account_id/account_id.h" |
| 31 #include "components/user_manager/user_info.h" | 32 #include "components/user_manager/user_info.h" |
| 32 #include "grit/ash_resources.h" | 33 #include "grit/ash_resources.h" |
| 33 #include "grit/ash_strings.h" | 34 #include "grit/ash_strings.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
| 36 #include "ui/gfx/paint_vector_icon.h" | 37 #include "ui/gfx/paint_vector_icon.h" |
| 38 #include "ui/views/controls/button/label_button.h" | |
| 39 #include "ui/views/controls/label.h" | |
| 37 #include "ui/views/layout/fill_layout.h" | 40 #include "ui/views/layout/fill_layout.h" |
| 38 #include "ui/views/painter.h" | 41 #include "ui/views/painter.h" |
| 39 | 42 |
| 40 namespace ash { | 43 namespace ash { |
| 41 namespace tray { | 44 namespace tray { |
| 42 | 45 |
| 43 namespace { | 46 namespace { |
| 44 | 47 |
| 48 bool UseMd() { | |
| 49 return MaterialDesignController::IsSystemTrayMenuMaterial(); | |
| 50 } | |
| 51 | |
| 45 const int kPublicAccountLogoutButtonBorderImagesNormal[] = { | 52 const int kPublicAccountLogoutButtonBorderImagesNormal[] = { |
| 46 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, | 53 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, |
| 47 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 54 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| 48 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 55 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| 49 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, | 56 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, |
| 50 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 57 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| 51 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 58 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| 52 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, | 59 IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER, |
| 53 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 60 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| 54 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, | 61 IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 166 |
| 160 add_user_ = new views::View; | 167 add_user_ = new views::View; |
| 161 add_user_->SetBorder( | 168 add_user_->SetBorder( |
| 162 views::Border::CreateEmptyBorder(0, kTrayUserTileHoverBorderInset, 0, 0)); | 169 views::Border::CreateEmptyBorder(0, kTrayUserTileHoverBorderInset, 0, 0)); |
| 163 | 170 |
| 164 add_user_->SetLayoutManager(new views::BoxLayout( | 171 add_user_->SetLayoutManager(new views::BoxLayout( |
| 165 views::BoxLayout::kHorizontal, 0, 0, kTrayPopupPaddingBetweenItems)); | 172 views::BoxLayout::kHorizontal, 0, 0, kTrayPopupPaddingBetweenItems)); |
| 166 AddChildViewAt(add_user_, 0); | 173 AddChildViewAt(add_user_, 0); |
| 167 | 174 |
| 168 // Add the icon which is also the anchor for messages. | 175 // Add the icon which is also the anchor for messages. |
| 169 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 176 if (UseMd()) { |
| 170 views::ImageView* icon = new views::ImageView(); | 177 views::ImageView* icon = new views::ImageView(); |
| 171 icon->SetImage( | 178 icon->SetImage( |
| 172 gfx::CreateVectorIcon(kSystemMenuNewUserIcon, kMenuIconColor)); | 179 gfx::CreateVectorIcon(kSystemMenuNewUserIcon, kMenuIconColor)); |
| 173 icon->SetBorder(views::Border::CreateEmptyBorder( | 180 icon->SetBorder(views::Border::CreateEmptyBorder( |
| 174 gfx::Insets((kTrayItemSize - icon->GetPreferredSize().width()) / 2))); | 181 gfx::Insets((kTrayItemSize - icon->GetPreferredSize().width()) / 2))); |
| 175 anchor_ = icon; | 182 anchor_ = icon; |
| 176 add_user_->AddChildView(icon); | 183 add_user_->AddChildView(icon); |
| 177 } else { | 184 } else { |
| 178 RoundedImageView* icon = | 185 RoundedImageView* icon = |
| 179 new RoundedImageView(kTrayRoundedBorderRadius, true); | 186 new RoundedImageView(kTrayRoundedBorderRadius, true); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 209 set_background(views::Background::CreateSolidBackground( | 216 set_background(views::Background::CreateSolidBackground( |
| 210 login == LoginStatus::PUBLIC ? kPublicAccountBackgroundColor | 217 login == LoginStatus::PUBLIC ? kPublicAccountBackgroundColor |
| 211 : kBackgroundColor)); | 218 : kBackgroundColor)); |
| 212 } | 219 } |
| 213 // The logout button must be added before the user card so that the user card | 220 // The logout button must be added before the user card so that the user card |
| 214 // can correctly calculate the remaining available width. | 221 // can correctly calculate the remaining available width. |
| 215 // Note that only the current multiprofile user gets a button. | 222 // Note that only the current multiprofile user gets a button. |
| 216 if (!user_index_) | 223 if (!user_index_) |
| 217 AddLogoutButton(login); | 224 AddLogoutButton(login); |
| 218 AddUserCard(login); | 225 AddUserCard(login); |
| 226 | |
| 227 if (UseMd()) { | |
| 228 auto* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, | |
| 229 kTrayPopupPaddingBetweenItems); | |
| 230 // Only the active user panel will be forced to a certain height. | |
| 231 if (!user_index_) { | |
| 232 layout->set_minimum_cross_axis_size( | |
| 233 GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); | |
| 234 } | |
| 235 layout->SetFlexForView(user_card_view_, 1); | |
| 236 SetLayoutManager(layout); | |
| 237 } | |
| 219 } | 238 } |
| 220 | 239 |
| 221 UserView::~UserView() { | 240 UserView::~UserView() { |
| 222 RemoveAddUserMenuOption(); | 241 RemoveAddUserMenuOption(); |
| 223 } | 242 } |
| 224 | 243 |
| 225 void UserView::MouseMovedOutOfHost() { | 244 void UserView::MouseMovedOutOfHost() { |
| 226 RemoveAddUserMenuOption(); | 245 RemoveAddUserMenuOption(); |
| 227 } | 246 } |
| 228 | 247 |
| 229 TrayUser::TestState UserView::GetStateForTest() const { | 248 TrayUser::TestState UserView::GetStateForTest() const { |
| 230 if (add_menu_option_.get()) { | 249 if (add_menu_option_.get()) { |
| 231 return add_user_enabled_ ? TrayUser::ACTIVE : TrayUser::ACTIVE_BUT_DISABLED; | 250 return add_user_enabled_ ? TrayUser::ACTIVE : TrayUser::ACTIVE_BUT_DISABLED; |
| 232 } | 251 } |
| 233 | 252 |
| 234 if (!is_user_card_button_) | 253 if (!is_user_card_button_) |
| 235 return TrayUser::SHOWN; | 254 return TrayUser::SHOWN; |
| 236 | 255 |
| 237 return static_cast<ButtonFromView*>(user_card_view_)->is_hovered_for_test() | 256 return static_cast<ButtonFromView*>(user_card_view_)->is_hovered_for_test() |
| 238 ? TrayUser::HOVERED | 257 ? TrayUser::HOVERED |
| 239 : TrayUser::SHOWN; | 258 : TrayUser::SHOWN; |
| 240 } | 259 } |
| 241 | 260 |
| 242 gfx::Rect UserView::GetBoundsInScreenOfUserButtonForTest() { | 261 gfx::Rect UserView::GetBoundsInScreenOfUserButtonForTest() { |
| 243 DCHECK(user_card_view_); | 262 DCHECK(user_card_view_); |
| 244 return user_card_view_->GetBoundsInScreen(); | 263 return user_card_view_->GetBoundsInScreen(); |
| 245 } | 264 } |
| 246 | 265 |
| 247 gfx::Size UserView::GetPreferredSize() const { | 266 gfx::Size UserView::GetPreferredSize() const { |
| 267 // MD uses a layout manager. | |
| 268 if (UseMd()) | |
| 269 return View::GetPreferredSize(); | |
| 270 | |
| 248 // The width is more or less ignored (set by other rows in the system menu). | 271 // The width is more or less ignored (set by other rows in the system menu). |
| 249 gfx::Size size; | 272 gfx::Size size = user_card_view_->GetPreferredSize(); |
| 250 if (user_card_view_) | |
| 251 size = user_card_view_->GetPreferredSize(); | |
| 252 if (logout_button_) | 273 if (logout_button_) |
| 253 size.SetToMax(logout_button_->GetPreferredSize()); | 274 size.SetToMax(logout_button_->GetPreferredSize()); |
| 254 // Only the active user panel will be forced to a certain height. | 275 // Only the active user panel will be forced to a certain height. |
| 255 if (!user_index_) { | 276 if (!user_index_) { |
| 256 size.set_height(std::max( | 277 size.set_height(std::max( |
| 257 size.height(), | 278 size.height(), |
| 258 GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT) + GetInsets().height())); | 279 GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT) + GetInsets().height())); |
| 259 } | 280 } |
| 260 return size; | 281 return size; |
| 261 } | 282 } |
| 262 | 283 |
| 263 int UserView::GetHeightForWidth(int width) const { | 284 int UserView::GetHeightForWidth(int width) const { |
| 264 return GetPreferredSize().height(); | 285 return GetPreferredSize().height(); |
| 265 } | 286 } |
| 266 | 287 |
| 267 void UserView::Layout() { | 288 void UserView::Layout() { |
|
tdanderson
2016/11/01 22:38:50
With the way you've changed the logic here, I assu
Evan Stade
2016/11/01 23:54:09
AddUserCard is called in the constructor and it al
| |
| 289 // MD uses a layout manager. | |
| 290 if (UseMd()) | |
| 291 return views::View::Layout(); | |
| 292 | |
| 268 gfx::Rect contents_area(GetContentsBounds()); | 293 gfx::Rect contents_area(GetContentsBounds()); |
| 269 if (user_card_view_ && logout_button_) { | 294 if (logout_button_) { |
| 270 // Give the logout button the space it requests. | 295 // Give the logout button the space it requests. |
| 271 gfx::Rect logout_area = contents_area; | 296 gfx::Rect logout_area = contents_area; |
| 272 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize()); | 297 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize()); |
| 273 logout_area.set_x(contents_area.right() - logout_area.width()); | 298 logout_area.set_x(contents_area.right() - logout_area.width()); |
| 274 | 299 |
| 275 // Give the remaining space to the user card. | 300 // Give the remaining space to the user card. |
| 276 gfx::Rect user_card_area = contents_area; | 301 gfx::Rect user_card_area = contents_area; |
| 277 int remaining_width = contents_area.width() - logout_area.width(); | 302 int remaining_width = contents_area.width() - logout_area.width(); |
| 278 if (IsMultiProfileSupportedAndUserActive()) { | 303 if (IsMultiProfileSupportedAndUserActive()) { |
| 279 // In multiprofile case |user_card_view_| and |logout_button_| have to | 304 // In multiprofile case |user_card_view_| and |logout_button_| have to |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 295 logout_area.set_width(logout_area.width() + | 320 logout_area.set_width(logout_area.width() + |
| 296 kTrayUserTileHoverBorderInset); | 321 kTrayUserTileHoverBorderInset); |
| 297 } else { | 322 } else { |
| 298 // In all other modes we have to make sure that there is enough spacing | 323 // In all other modes we have to make sure that there is enough spacing |
| 299 // between the two. | 324 // between the two. |
| 300 remaining_width -= kTrayPopupPaddingBetweenItems; | 325 remaining_width -= kTrayPopupPaddingBetweenItems; |
| 301 } | 326 } |
| 302 user_card_area.set_width(remaining_width); | 327 user_card_area.set_width(remaining_width); |
| 303 user_card_view_->SetBoundsRect(user_card_area); | 328 user_card_view_->SetBoundsRect(user_card_area); |
| 304 logout_button_->SetBoundsRect(logout_area); | 329 logout_button_->SetBoundsRect(logout_area); |
| 305 } else if (user_card_view_) { | 330 } else { |
| 306 user_card_view_->SetBoundsRect(contents_area); | 331 user_card_view_->SetBoundsRect(contents_area); |
| 307 } else if (logout_button_) { | |
| 308 logout_button_->SetBoundsRect(contents_area); | |
| 309 } | 332 } |
| 310 } | 333 } |
| 311 | 334 |
| 312 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 335 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 313 if (sender == logout_button_) { | 336 if (sender == logout_button_) { |
| 314 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); | 337 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); |
| 315 RemoveAddUserMenuOption(); | 338 RemoveAddUserMenuOption(); |
| 316 WmShell::Get()->system_tray_delegate()->SignOut(); | 339 WmShell::Get()->system_tray_delegate()->SignOut(); |
| 317 } else if (sender == user_card_view_ && | 340 } else if (sender == user_card_view_ && |
| 318 IsMultiProfileSupportedAndUserActive()) { | 341 IsMultiProfileSupportedAndUserActive()) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 342 RemoveAddUserMenuOption(); | 365 RemoveAddUserMenuOption(); |
| 343 } | 366 } |
| 344 | 367 |
| 345 void UserView::OnDidChangeFocus(View* focused_before, View* focused_now) { | 368 void UserView::OnDidChangeFocus(View* focused_before, View* focused_now) { |
| 346 // Nothing to do here. | 369 // Nothing to do here. |
| 347 } | 370 } |
| 348 | 371 |
| 349 void UserView::AddLogoutButton(LoginStatus login) { | 372 void UserView::AddLogoutButton(LoginStatus login) { |
| 350 const base::string16 title = | 373 const base::string16 title = |
| 351 user::GetLocalizedSignOutStringForStatus(login, true); | 374 user::GetLocalizedSignOutStringForStatus(login, true); |
| 352 auto* logout_button = new TrayPopupLabelButton(this, title); | 375 auto* logout_button = CreateTrayPopupBorderlessButton(this, title); |
| 353 logout_button->SetAccessibleName(title); | 376 logout_button->SetAccessibleName(title); |
| 354 logout_button_ = logout_button; | 377 logout_button_ = logout_button; |
| 355 // In public account mode, the logout button border has a custom color. | 378 // In public account mode, the logout button border has a custom color. |
| 356 if (login == LoginStatus::PUBLIC) { | 379 if (login == LoginStatus::PUBLIC) { |
| 357 std::unique_ptr<TrayPopupLabelButtonBorder> border( | 380 std::unique_ptr<TrayPopupLabelButtonBorder> border( |
| 358 new TrayPopupLabelButtonBorder()); | 381 new TrayPopupLabelButtonBorder()); |
| 359 border->SetPainter(false, views::Button::STATE_NORMAL, | 382 border->SetPainter(false, views::Button::STATE_NORMAL, |
| 360 views::Painter::CreateImageGridPainter( | 383 views::Painter::CreateImageGridPainter( |
| 361 kPublicAccountLogoutButtonBorderImagesNormal)); | 384 kPublicAccountLogoutButtonBorderImagesNormal)); |
| 362 border->SetPainter(false, views::Button::STATE_HOVERED, | 385 border->SetPainter(false, views::Button::STATE_HOVERED, |
| 363 views::Painter::CreateImageGridPainter( | 386 views::Painter::CreateImageGridPainter( |
| 364 kPublicAccountLogoutButtonBorderImagesHovered)); | 387 kPublicAccountLogoutButtonBorderImagesHovered)); |
| 365 border->SetPainter(false, views::Button::STATE_PRESSED, | 388 border->SetPainter(false, views::Button::STATE_PRESSED, |
| 366 views::Painter::CreateImageGridPainter( | 389 views::Painter::CreateImageGridPainter( |
| 367 kPublicAccountLogoutButtonBorderImagesHovered)); | 390 kPublicAccountLogoutButtonBorderImagesHovered)); |
| 368 logout_button_->SetBorder(std::move(border)); | 391 logout_button_->SetBorder(std::move(border)); |
| 369 } | 392 } |
| 370 AddChildView(logout_button_); | 393 AddChildView(logout_button_); |
| 371 } | 394 } |
| 372 | 395 |
| 373 void UserView::AddUserCard(LoginStatus login) { | 396 void UserView::AddUserCard(LoginStatus login) { |
| 374 // Add padding around the panel. | 397 // Add padding around the panel. |
| 375 // TODO(estade): share this constant? | 398 // TODO(estade): share this constant? |
| 376 const int kSidePadding = MaterialDesignController::IsSystemTrayMenuMaterial() | 399 const int kSidePadding = UseMd() ? 12 : kTrayPopupPaddingHorizontal; |
| 377 ? 12 | |
| 378 : kTrayPopupPaddingHorizontal; | |
| 379 SetBorder(views::Border::CreateEmptyBorder( | 400 SetBorder(views::Border::CreateEmptyBorder( |
| 380 kTrayPopupUserCardVerticalPadding, kSidePadding, | 401 kTrayPopupUserCardVerticalPadding, kSidePadding, |
| 381 kTrayPopupUserCardVerticalPadding, kSidePadding)); | 402 kTrayPopupUserCardVerticalPadding, kSidePadding)); |
| 382 | 403 |
| 383 views::TrayBubbleView* bubble_view = | 404 views::TrayBubbleView* bubble_view = |
| 384 owner_->system_tray()->GetSystemBubble()->bubble_view(); | 405 owner_->system_tray()->GetSystemBubble()->bubble_view(); |
| 385 int max_card_width = bubble_view->GetMaximumSize().width() - | 406 int max_card_width = bubble_view->GetMaximumSize().width() - |
| 386 (2 * kSidePadding + kTrayPopupPaddingBetweenItems); | 407 (2 * kSidePadding + kTrayPopupPaddingBetweenItems); |
| 387 if (logout_button_) | 408 if (logout_button_) |
| 388 max_card_width -= logout_button_->GetPreferredSize().width(); | 409 max_card_width -= logout_button_->GetPreferredSize().width(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 406 views::View* contents_view = user_card_view_; | 427 views::View* contents_view = user_card_view_; |
| 407 if (user_index_) { | 428 if (user_index_) { |
| 408 // Since the activation border needs to be drawn around the tile, we | 429 // Since the activation border needs to be drawn around the tile, we |
| 409 // have to put the tile into another view which fills the menu panel, | 430 // have to put the tile into another view which fills the menu panel, |
| 410 // but keeping the offsets of the content. | 431 // but keeping the offsets of the content. |
| 411 contents_view = new views::View(); | 432 contents_view = new views::View(); |
| 412 contents_view->SetBorder(views::Border::CreateEmptyBorder( | 433 contents_view->SetBorder(views::Border::CreateEmptyBorder( |
| 413 kTrayPopupUserCardVerticalPadding, kSidePadding, | 434 kTrayPopupUserCardVerticalPadding, kSidePadding, |
| 414 kTrayPopupUserCardVerticalPadding, kSidePadding)); | 435 kTrayPopupUserCardVerticalPadding, kSidePadding)); |
| 415 contents_view->SetLayoutManager(new views::FillLayout()); | 436 contents_view->SetLayoutManager(new views::FillLayout()); |
| 416 SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 0)); | 437 SetBorder(nullptr); |
| 417 contents_view->AddChildView(user_card_view_); | 438 contents_view->AddChildView(user_card_view_); |
| 418 insets = gfx::Insets(1, 1, 1, 3); | 439 insets = gfx::Insets(1, 1, 1, 3); |
| 419 } | 440 } |
| 420 bool highlight = !MaterialDesignController::IsSystemTrayMenuMaterial() && | 441 bool highlight = !UseMd() && user_index_ == 0; |
| 421 user_index_ == 0; | |
| 422 auto* button = new ButtonFromView(contents_view, this, highlight, insets); | 442 auto* button = new ButtonFromView(contents_view, this, highlight, insets); |
| 423 user_card_view_ = button; | 443 user_card_view_ = button; |
| 424 is_user_card_button_ = true; | 444 is_user_card_button_ = true; |
| 425 } | 445 } |
| 426 AddChildViewAt(user_card_view_, 0); | 446 AddChildViewAt(user_card_view_, 0); |
| 427 // Card for supervised user can consume more space than currently | 447 // Card for supervised user can consume more space than currently |
| 428 // available. In that case we should increase system bubble's width. | 448 // available. In that case we should increase system bubble's width. |
| 429 if (login == LoginStatus::PUBLIC) | 449 if (login == LoginStatus::PUBLIC) |
| 430 bubble_view->SetWidth(GetPreferredSize().width()); | 450 bubble_view->SetWidth(GetPreferredSize().width()); |
| 431 } | 451 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 focus_manager_ = NULL; | 554 focus_manager_ = NULL; |
| 535 if (user_card_view_->GetFocusManager()) | 555 if (user_card_view_->GetFocusManager()) |
| 536 user_card_view_->GetFocusManager()->ClearFocus(); | 556 user_card_view_->GetFocusManager()->ClearFocus(); |
| 537 popup_message_.reset(); | 557 popup_message_.reset(); |
| 538 mouse_watcher_.reset(); | 558 mouse_watcher_.reset(); |
| 539 add_menu_option_.reset(); | 559 add_menu_option_.reset(); |
| 540 } | 560 } |
| 541 | 561 |
| 542 } // namespace tray | 562 } // namespace tray |
| 543 } // namespace ash | 563 } // namespace ash |
| OLD | NEW |