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/ash_resources.h" | 10 #include "grit/ash_resources.h" |
11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
14 #include "ui/views/controls/image_view.h" | 14 #include "ui/views/controls/image_view.h" |
15 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
16 #include "ui/views/layout/box_layout.h" | 16 #include "ui/views/layout/box_layout.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 TrayItemMore::TrayItemMore(SystemTrayItem* owner, bool show_more) | 21 TrayItemMore::TrayItemMore(SystemTrayItem* tray, bool show_more) |
22 : owner_(owner), | 22 : tray_(tray), |
23 show_more_(show_more), | 23 show_more_(show_more), |
24 icon_(NULL), | 24 icon_(NULL), |
25 label_(NULL), | 25 label_(NULL), |
26 more_(NULL) { | 26 more_(NULL) { |
27 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 27 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
28 kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); | 28 kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); |
29 | 29 |
30 icon_ = new FixedSizedImageView(0, kTrayPopupItemHeight); | 30 icon_ = new FixedSizedImageView(0, kTrayPopupItemHeight); |
31 AddChildView(icon_); | 31 AddChildView(icon_); |
32 | 32 |
(...skipping 30 matching lines...) Expand all Loading... |
63 void TrayItemMore::ReplaceIcon(views::View* view) { | 63 void TrayItemMore::ReplaceIcon(views::View* view) { |
64 delete icon_; | 64 delete icon_; |
65 icon_ = NULL; | 65 icon_ = NULL; |
66 AddChildViewAt(view, 0); | 66 AddChildViewAt(view, 0); |
67 } | 67 } |
68 | 68 |
69 bool TrayItemMore::PerformAction(const ui::Event& event) { | 69 bool TrayItemMore::PerformAction(const ui::Event& event) { |
70 if (!show_more_) | 70 if (!show_more_) |
71 return false; | 71 return false; |
72 | 72 |
73 owner_->TransitionDetailedView(); | 73 tray()->TransitionDetailedView(); |
74 return true; | 74 return true; |
75 } | 75 } |
76 | 76 |
77 void TrayItemMore::Layout() { | 77 void TrayItemMore::Layout() { |
78 // Let the box-layout do the layout first. Then move the '>' arrow to right | 78 // Let the box-layout do the layout first. Then move the '>' arrow to right |
79 // align. | 79 // align. |
80 views::View::Layout(); | 80 views::View::Layout(); |
81 | 81 |
82 if (!show_more_) | 82 if (!show_more_) |
83 return; | 83 return; |
(...skipping 13 matching lines...) Expand all Loading... |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void TrayItemMore::GetAccessibleState(ui::AccessibleViewState* state) { | 100 void TrayItemMore::GetAccessibleState(ui::AccessibleViewState* state) { |
101 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 101 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
102 state->name = accessible_name_; | 102 state->name = accessible_name_; |
103 } | 103 } |
104 | 104 |
105 } // namespace internal | 105 } // namespace internal |
106 } // namespace ash | 106 } // namespace ash |
OLD | NEW |