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