Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / athena / home / minimized_home.cc
blob2b0bafb8d6638a4a7a949cca3ae5b28d78ff2880
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "athena/home/minimized_home.h"
7 #include "ui/compositor/layer.h"
8 #include "ui/compositor/layer_owner.h"
9 #include "ui/gfx/canvas.h"
11 namespace {
13 const int kDragHandleWidth = 112;
14 const int kDragHandleHeight = 2;
15 const char kMinimizedHomeLayerName[] = "MinimizedHome";
17 class MinimizedHomePainter : public ui::LayerDelegate,
18 public ui::LayerOwner {
19 public:
20 explicit MinimizedHomePainter(ui::Layer* layer) {
21 layer->set_name(kMinimizedHomeLayerName);
22 layer->set_delegate(this);
23 SetLayer(layer);
25 virtual ~MinimizedHomePainter() {}
27 private:
28 // ui::LayerDelegate:
29 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
30 gfx::Rect bounds(layer()->GetTargetBounds().size());
31 canvas->FillRect(bounds, SK_ColorBLACK);
32 canvas->FillRect(gfx::Rect((bounds.width() - kDragHandleWidth) / 2,
33 bounds.bottom() - kDragHandleHeight,
34 kDragHandleWidth,
35 kDragHandleHeight),
36 SK_ColorWHITE);
39 virtual void OnDelegatedFrameDamage(
40 const gfx::Rect& damage_rect_in_dip) OVERRIDE {
43 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
46 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE {
47 return base::Closure();
50 DISALLOW_COPY_AND_ASSIGN(MinimizedHomePainter);
53 } // namespace
55 namespace athena {
57 scoped_ptr<ui::LayerOwner> CreateMinimizedHome() {
58 return scoped_ptr<ui::LayerOwner>(
59 new MinimizedHomePainter(new ui::Layer(ui::LAYER_TEXTURED)));
62 } // namespace athena