OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/system/background_controller.h" | 5 #include "athena/system/background_controller.h" |
6 | 6 |
7 #include "athena/system/public/system_ui.h" | 7 #include "athena/system/public/system_ui.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 AddChildView(system_info_view_); | 22 AddChildView(system_info_view_); |
23 } | 23 } |
24 virtual ~BackgroundView() {} | 24 virtual ~BackgroundView() {} |
25 | 25 |
26 void SetImage(const gfx::ImageSkia& image) { | 26 void SetImage(const gfx::ImageSkia& image) { |
27 image_ = image; | 27 image_ = image; |
28 SchedulePaint(); | 28 SchedulePaint(); |
29 } | 29 } |
30 | 30 |
31 // views::View: | 31 // views::View: |
32 virtual void Layout() OVERRIDE { | 32 virtual void Layout() override { |
33 system_info_view_->SetBounds( | 33 system_info_view_->SetBounds( |
34 0, 0, width(), system_info_view_->GetPreferredSize().height()); | 34 0, 0, width(), system_info_view_->GetPreferredSize().height()); |
35 } | 35 } |
36 | 36 |
37 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 37 virtual void OnPaint(gfx::Canvas* canvas) override { |
38 canvas->DrawImageInt(image_, | 38 canvas->DrawImageInt(image_, |
39 0, | 39 0, |
40 0, | 40 0, |
41 image_.width(), | 41 image_.width(), |
42 image_.height(), | 42 image_.height(), |
43 0, | 43 0, |
44 0, | 44 0, |
45 width(), | 45 width(), |
46 height(), | 46 height(), |
47 true); | 47 true); |
(...skipping 23 matching lines...) Expand all Loading... |
71 // background_widget is owned by the container and will be deleted | 71 // background_widget is owned by the container and will be deleted |
72 // when the container is deleted. | 72 // when the container is deleted. |
73 } | 73 } |
74 | 74 |
75 void BackgroundController::SetImage(const gfx::ImageSkia& image) { | 75 void BackgroundController::SetImage(const gfx::ImageSkia& image) { |
76 // TODO(oshima): implement cross fede animation. | 76 // TODO(oshima): implement cross fede animation. |
77 background_view_->SetImage(image); | 77 background_view_->SetImage(image); |
78 } | 78 } |
79 | 79 |
80 } // namespace athena | 80 } // namespace athena |
OLD | NEW |