| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 namespace { | 81 namespace { |
| 82 | 82 |
| 83 // A tray item that just reserves space in the tray. | 83 // A tray item that just reserves space in the tray. |
| 84 class PaddingTrayItem : public SystemTrayItem { | 84 class PaddingTrayItem : public SystemTrayItem { |
| 85 public: | 85 public: |
| 86 PaddingTrayItem() : SystemTrayItem(nullptr, UMA_NOT_RECORDED) {} | 86 PaddingTrayItem() : SystemTrayItem(nullptr, UMA_NOT_RECORDED) {} |
| 87 ~PaddingTrayItem() override {} | 87 ~PaddingTrayItem() override {} |
| 88 | 88 |
| 89 // SystemTrayItem: | 89 // SystemTrayItem: |
| 90 views::View* CreateTrayView(LoginStatus status) override { | 90 views::View* CreateTrayView(LoginStatus status) override { |
| 91 return new PaddingView(); | 91 auto* padding = new views::View(); |
| 92 // The other tray items already have some padding baked in so we have to |
| 93 // subtract that off. |
| 94 constexpr int side = kTrayEdgePadding - kTrayImageItemPadding; |
| 95 padding->set_preferred_size(gfx::Size(side, side)); |
| 96 return padding; |
| 92 } | 97 } |
| 93 | 98 |
| 94 private: | 99 private: |
| 95 class PaddingView : public views::View { | |
| 96 public: | |
| 97 PaddingView() {} | |
| 98 ~PaddingView() override {} | |
| 99 | |
| 100 private: | |
| 101 gfx::Size GetPreferredSize() const override { | |
| 102 // The other tray items already have some padding baked in so we have to | |
| 103 // subtract that off. | |
| 104 const int side = kTrayEdgePadding - kTrayImageItemPadding; | |
| 105 return gfx::Size(side, side); | |
| 106 } | |
| 107 | |
| 108 DISALLOW_COPY_AND_ASSIGN(PaddingView); | |
| 109 }; | |
| 110 | |
| 111 DISALLOW_COPY_AND_ASSIGN(PaddingTrayItem); | 100 DISALLOW_COPY_AND_ASSIGN(PaddingTrayItem); |
| 112 }; | 101 }; |
| 113 | 102 |
| 114 } // namespace | 103 } // namespace |
| 115 | 104 |
| 116 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper | 105 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper |
| 117 // instances for a bubble. | 106 // instances for a bubble. |
| 118 | 107 |
| 119 class SystemBubbleWrapper { | 108 class SystemBubbleWrapper { |
| 120 public: | 109 public: |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 .work_area() | 711 .work_area() |
| 723 .height(); | 712 .height(); |
| 724 if (work_area_height > 0) { | 713 if (work_area_height > 0) { |
| 725 UMA_HISTOGRAM_CUSTOM_COUNTS( | 714 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 726 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 715 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 727 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 716 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 728 } | 717 } |
| 729 } | 718 } |
| 730 | 719 |
| 731 } // namespace ash | 720 } // namespace ash |
| OLD | NEW |