| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/screen_security/screen_tray_item.h" | 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
| 9 #include "ash/common/system/tray/fixed_sized_image_view.h" | 9 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); | 74 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 75 if (!use_md) | 75 if (!use_md) |
| 76 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 76 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
| 77 | 77 |
| 78 auto layout = | 78 auto layout = |
| 79 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, | 79 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, |
| 80 use_md ? kTrayPopupPaddingBetweenItems : 0); | 80 use_md ? kTrayPopupPaddingBetweenItems : 0); |
| 81 layout->set_cross_axis_alignment( | 81 layout->set_cross_axis_alignment( |
| 82 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 82 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
| 83 SetLayoutManager(layout); | 83 SetLayoutManager(layout); |
| 84 SetBorder(views::Border::CreateEmptyBorder( | 84 SetBorder(views::CreateEmptyBorder( |
| 85 0, kTrayPopupPaddingHorizontal, 0, | 85 0, kTrayPopupPaddingHorizontal, 0, |
| 86 use_md ? kTrayPopupButtonEndMargin : kStopButtonRightPadding)); | 86 use_md ? kTrayPopupButtonEndMargin : kStopButtonRightPadding)); |
| 87 | 87 |
| 88 icon_ = new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); | 88 icon_ = new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); |
| 89 if (use_md) { | 89 if (use_md) { |
| 90 icon_->SetImage( | 90 icon_->SetImage( |
| 91 gfx::CreateVectorIcon(kSystemMenuScreenShareIcon, kMenuIconColor)); | 91 gfx::CreateVectorIcon(kSystemMenuScreenShareIcon, kMenuIconColor)); |
| 92 } else { | 92 } else { |
| 93 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 93 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 94 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK) | 94 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK) |
| 95 .ToImageSkia()); | 95 .ToImageSkia()); |
| 96 } | 96 } |
| 97 AddChildView(icon_); | 97 AddChildView(icon_); |
| 98 | 98 |
| 99 label_ = new views::Label; | 99 label_ = new views::Label; |
| 100 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 100 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 101 label_->SetMultiLine(true); | 101 label_->SetMultiLine(true); |
| 102 label_->SetText(label_text_); | 102 label_->SetText(label_text_); |
| 103 if (!use_md) { | 103 if (!use_md) { |
| 104 label_->SetBorder(views::Border::CreateEmptyBorder( | 104 label_->SetBorder( |
| 105 0, kTrayPopupPaddingBetweenItems, 0, 0)); | 105 views::CreateEmptyBorder(0, kTrayPopupPaddingBetweenItems, 0, 0)); |
| 106 } | 106 } |
| 107 AddChildView(label_); | 107 AddChildView(label_); |
| 108 layout->SetFlexForView(label_, 1); | 108 layout->SetFlexForView(label_, 1); |
| 109 | 109 |
| 110 stop_button_ = CreateTrayPopupButton(this, stop_button_text_); | 110 stop_button_ = CreateTrayPopupButton(this, stop_button_text_); |
| 111 AddChildView(stop_button_); | 111 AddChildView(stop_button_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ScreenStatusView::UpdateFromScreenTrayItem() { | 114 void ScreenStatusView::UpdateFromScreenTrayItem() { |
| 115 // Hide the notification bubble when the ash tray bubble opens. | 115 // Hide the notification bubble when the ash tray bubble opens. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 void ScreenTrayItem::DestroyTrayView() { | 193 void ScreenTrayItem::DestroyTrayView() { |
| 194 tray_view_ = nullptr; | 194 tray_view_ = nullptr; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ScreenTrayItem::DestroyDefaultView() { | 197 void ScreenTrayItem::DestroyDefaultView() { |
| 198 default_view_ = nullptr; | 198 default_view_ = nullptr; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace ash | 201 } // namespace ash |
| OLD | NEW |