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/tray_item_more.h" | 5 #include "ash/system/tray/tray_item_more.h" |
6 | 6 |
7 #include "ash/system/tray/system_tray_item.h" | 7 #include "ash/system/tray/system_tray_item.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "ash/system/tray/tray_views.h" | 9 #include "ash/system/tray/tray_views.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Make sure the chevron always has the full size. | 68 // Make sure the chevron always has the full size. |
69 gfx::Size size = more_->GetPreferredSize(); | 69 gfx::Size size = more_->GetPreferredSize(); |
70 gfx::Rect bounds(size); | 70 gfx::Rect bounds(size); |
71 bounds.set_x(width() - size.width() - kTrayPopupPaddingBetweenItems); | 71 bounds.set_x(width() - size.width() - kTrayPopupPaddingBetweenItems); |
72 bounds.set_y((height() - size.height()) / 2); | 72 bounds.set_y((height() - size.height()) / 2); |
73 more_->SetBoundsRect(bounds); | 73 more_->SetBoundsRect(bounds); |
74 | 74 |
75 // Adjust the label's bounds in case it got cut off by |more_|. | 75 // Adjust the label's bounds in case it got cut off by |more_|. |
76 if (label_->bounds().Intersects(more_->bounds())) { | 76 if (label_->bounds().Intersects(more_->bounds())) { |
77 label_->SetBoundsRect(label_->bounds().Subtract(more_->bounds())); | 77 gfx::Rect bounds = label_->bounds(); |
| 78 bounds.set_width(more_->x() - kTrayPopupPaddingBetweenItems - label_->x()); |
| 79 label_->SetBoundsRect(bounds); |
78 } | 80 } |
79 } | 81 } |
80 | 82 |
81 bool TrayItemMore::OnKeyPressed(const views::KeyEvent& event) { | 83 bool TrayItemMore::OnKeyPressed(const views::KeyEvent& event) { |
82 if (event.key_code() == ui::VKEY_SPACE || | 84 if (event.key_code() == ui::VKEY_SPACE || |
83 event.key_code() == ui::VKEY_RETURN) { | 85 event.key_code() == ui::VKEY_RETURN) { |
84 owner_->PopupDetailedView(0, true); | 86 owner_->PopupDetailedView(0, true); |
85 return true; | 87 return true; |
86 } | 88 } |
87 return false; | 89 return false; |
88 } | 90 } |
89 | 91 |
90 bool TrayItemMore::OnMousePressed(const views::MouseEvent& event) { | 92 bool TrayItemMore::OnMousePressed(const views::MouseEvent& event) { |
91 owner_->PopupDetailedView(0, true); | 93 owner_->PopupDetailedView(0, true); |
92 return true; | 94 return true; |
93 } | 95 } |
94 | 96 |
95 void TrayItemMore::GetAccessibleState(ui::AccessibleViewState* state) { | 97 void TrayItemMore::GetAccessibleState(ui::AccessibleViewState* state) { |
96 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 98 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
97 state->name = accessible_name_; | 99 state->name = accessible_name_; |
98 } | 100 } |
99 | 101 |
100 } // namespace internal | 102 } // namespace internal |
101 } // namespace ash | 103 } // namespace ash |
OLD | NEW |