Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: athena/home/minimized_home.cc

Issue 478293004: Refactor the home card structure and introduce animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rease Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« athena/home/minimized_home.h ('K') | « athena/home/minimized_home.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/home/minimized_home.cc
diff --git a/athena/home/minimized_home.cc b/athena/home/minimized_home.cc
index 3ffd65b1cf84d8bbe2be0151b3ac6954443c7846..9cede2d0eb04d473f7f46a1d498434f0e16f78fe 100644
--- a/athena/home/minimized_home.cc
+++ b/athena/home/minimized_home.cc
@@ -4,24 +4,30 @@
#include "athena/home/minimized_home.h"
-#include "athena/wm/public/window_manager.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_owner.h"
#include "ui/gfx/canvas.h"
-#include "ui/views/background.h"
-#include "ui/views/view.h"
namespace {
const int kDragHandleWidth = 112;
const int kDragHandleHeight = 2;
+const char kMinimizedHomeLayerName[] = "MinimizedHome";
-class MinimizedHomeBackground : public views::Background {
+class MinimizedHomePainter : public ui::LayerDelegate,
+ public ui::LayerOwner {
public:
- MinimizedHomeBackground() {}
- virtual ~MinimizedHomeBackground() {}
+ MinimizedHomePainter(ui::Layer* layer) {
sadrul 2014/08/26 15:47:26 explicit
Jun Mukai 2014/08/26 17:21:33 Done.
+ layer->set_name(kMinimizedHomeLayerName);
+ layer->set_delegate(this);
+ SetLayer(layer);
+ }
+ virtual ~MinimizedHomePainter() {}
private:
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
- gfx::Rect bounds = view->GetLocalBounds();
+ // ui::LayerDelegate:
+ virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
+ gfx::Rect bounds(layer()->GetTargetBounds().size());
canvas->FillRect(bounds, SK_ColorBLACK);
canvas->FillRect(gfx::Rect((bounds.width() - kDragHandleWidth) / 2,
bounds.bottom() - kDragHandleHeight,
@@ -30,37 +36,27 @@ class MinimizedHomeBackground : public views::Background {
SK_ColorWHITE);
}
- DISALLOW_COPY_AND_ASSIGN(MinimizedHomeBackground);
-};
+ virtual void OnDelegatedFrameDamage(
+ const gfx::Rect& damage_rect_in_dip) OVERRIDE {
+ }
-// 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() {
- set_background(new MinimizedHomeBackground());
+ virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
}
- virtual ~MinimizedHomeView() {}
- private:
- // views::View:
- virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
- if (event.IsLeftMouseButton() && event.GetClickCount() == 1) {
- athena::WindowManager::GetInstance()->ToggleOverview();
- return true;
- }
- return false;
+ virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE {
+ return base::Closure();
}
- DISALLOW_COPY_AND_ASSIGN(MinimizedHomeView);
+ DISALLOW_COPY_AND_ASSIGN(MinimizedHomePainter);
};
} // namespace
namespace athena {
-views::View* CreateMinimizedHome() {
- return new MinimizedHomeView();
+scoped_ptr<ui::LayerOwner> CreateMinimizedHome() {
+ return scoped_ptr<ui::LayerOwner>(
+ new MinimizedHomePainter(new ui::Layer(ui::LAYER_TEXTURED)));
}
} // namespace athena
« athena/home/minimized_home.h ('K') | « athena/home/minimized_home.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698