| Index: athena/home/minimized_home.cc
|
| diff --git a/athena/home/minimized_home.cc b/athena/home/minimized_home.cc
|
| index b38c909a0b4894d3f170a4c72392bea364442fc4..3ffd65b1cf84d8bbe2be0151b3ac6954443c7846 100644
|
| --- a/athena/home/minimized_home.cc
|
| +++ b/athena/home/minimized_home.cc
|
| @@ -5,90 +5,53 @@
|
| #include "athena/home/minimized_home.h"
|
|
|
| #include "athena/wm/public/window_manager.h"
|
| +#include "ui/gfx/canvas.h"
|
| #include "ui/views/background.h"
|
| -#include "ui/views/layout/box_layout.h"
|
| #include "ui/views/view.h"
|
| -#include "ui/views/widget/widget.h"
|
|
|
| namespace {
|
|
|
| -const SkColor kDragHandleColorNormal = SK_ColorGRAY;
|
| -const SkColor kDragHandleColorHot = SK_ColorWHITE;
|
| +const int kDragHandleWidth = 112;
|
| +const int kDragHandleHeight = 2;
|
|
|
| -// The small white bar in the middle of the minimized view. Does not reach to
|
| -// events.
|
| -class SmallBarView : public views::View {
|
| +class MinimizedHomeBackground : public views::Background {
|
| public:
|
| - SmallBarView() : color_(SK_ColorTRANSPARENT) {
|
| - SetColor(kDragHandleColorNormal);
|
| - }
|
| -
|
| - virtual ~SmallBarView() {}
|
| -
|
| - void SetActive(bool active) {
|
| - SetColor(active ? kDragHandleColorHot : kDragHandleColorNormal);
|
| - }
|
| + MinimizedHomeBackground() {}
|
| + virtual ~MinimizedHomeBackground() {}
|
|
|
| private:
|
| - void SetColor(SkColor color) {
|
| - if (color_ == color)
|
| - return;
|
| - color_ = color;
|
| - set_background(views::Background::CreateSolidBackground(color_));
|
| - SchedulePaint();
|
| + virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
|
| + gfx::Rect bounds = view->GetLocalBounds();
|
| + canvas->FillRect(bounds, SK_ColorBLACK);
|
| + canvas->FillRect(gfx::Rect((bounds.width() - kDragHandleWidth) / 2,
|
| + bounds.bottom() - kDragHandleHeight,
|
| + kDragHandleWidth,
|
| + kDragHandleHeight),
|
| + SK_ColorWHITE);
|
| }
|
|
|
| - // views::View
|
| - virtual gfx::Size GetPreferredSize() const OVERRIDE {
|
| - const int kDragHandleWidth = 80;
|
| - const int kDragHandleHeight = 4;
|
| - return gfx::Size(kDragHandleWidth, kDragHandleHeight);
|
| - }
|
| -
|
| - SkColor color_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(SmallBarView);
|
| + DISALLOW_COPY_AND_ASSIGN(MinimizedHomeBackground);
|
| };
|
|
|
| // This View shows an instance of SmallBarView in the middle, and reacts to
|
| // mouse and touch-gesture events.
|
| class MinimizedHomeView : public views::View {
|
| public:
|
| - MinimizedHomeView()
|
| - : bar_(new SmallBarView) {
|
| - set_background(views::Background::CreateSolidBackground(SK_ColorBLACK));
|
| - views::BoxLayout* layout =
|
| - new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 2, 0);
|
| - layout->set_main_axis_alignment(
|
| - views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
|
| - SetLayoutManager(layout);
|
| -
|
| - AddChildView(bar_);
|
| + MinimizedHomeView() {
|
| + set_background(new MinimizedHomeBackground());
|
| }
|
| virtual ~MinimizedHomeView() {}
|
|
|
| private:
|
| - // TODO(mukai): unify mouse event handling to the HomeCardGestureManager.
|
| // views::View:
|
| virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
|
| if (event.IsLeftMouseButton() && event.GetClickCount() == 1) {
|
| - bar_->SetActive(false);
|
| athena::WindowManager::GetInstance()->ToggleOverview();
|
| return true;
|
| }
|
| return false;
|
| }
|
|
|
| - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE {
|
| - bar_->SetActive(true);
|
| - }
|
| -
|
| - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE {
|
| - bar_->SetActive(false);
|
| - }
|
| -
|
| - SmallBarView* bar_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(MinimizedHomeView);
|
| };
|
|
|
|
|