OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/tray/tray_popup_item_container.h" | 5 #include "ash/common/system/tray/tray_popup_item_container.h" |
6 | 6 |
7 #include "ash/common/system/tray/tray_constants.h" | 7 #include "ash/common/system/tray/tray_constants.h" |
8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
9 #include "ui/views/layout/box_layout.h" | 9 #include "ui/views/layout/box_layout.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 TrayPopupItemContainer::TrayPopupItemContainer(views::View* view, | 13 TrayPopupItemContainer::TrayPopupItemContainer(views::View* view, |
14 bool change_background) | 14 bool change_background) |
15 : active_(false), change_background_(change_background) { | 15 : active_(false), change_background_(change_background) { |
16 set_notify_enter_exit_on_child(true); | 16 set_notify_enter_exit_on_child(true); |
17 views::BoxLayout* layout = | 17 views::BoxLayout* layout = |
18 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 18 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
19 layout->SetDefaultFlex(1); | 19 layout->SetDefaultFlex(1); |
20 SetLayoutManager(layout); | 20 SetLayoutManager(layout); |
21 if (view->layer()) { | 21 if (view->layer()) { |
22 SetPaintToLayer(true); | 22 SetPaintToLayer(); |
23 layer()->SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); | 23 layer()->SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); |
24 } | 24 } |
25 AddChildView(view); | 25 AddChildView(view); |
26 SetVisible(view->visible()); | 26 SetVisible(view->visible()); |
27 } | 27 } |
28 | 28 |
29 TrayPopupItemContainer::~TrayPopupItemContainer() {} | 29 TrayPopupItemContainer::~TrayPopupItemContainer() {} |
30 | 30 |
31 void TrayPopupItemContainer::SetActive(bool active) { | 31 void TrayPopupItemContainer::SetActive(bool active) { |
32 if (!change_background_ || active_ == active) | 32 if (!change_background_ || active_ == active) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return; | 68 return; |
69 | 69 |
70 views::View* view = child_at(0); | 70 views::View* view = child_at(0); |
71 if (!view->background()) { | 71 if (!view->background()) { |
72 canvas->FillRect(gfx::Rect(size()), | 72 canvas->FillRect(gfx::Rect(size()), |
73 (active_) ? kHoverBackgroundColor : kBackgroundColor); | 73 (active_) ? kHoverBackgroundColor : kBackgroundColor); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace ash | 77 } // namespace ash |
OLD | NEW |