| 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/screen/background_controller.h" | 5 #include "athena/screen/background_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/compositor/layer.h" | 8 #include "ui/compositor/layer.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 BackgroundController::BackgroundController(aura::Window* container) { | 46 BackgroundController::BackgroundController(aura::Window* container) { |
| 47 // TODO(oshima): Using widget to just draw an image is probably | 47 // TODO(oshima): Using widget to just draw an image is probably |
| 48 // overkill. Just use WindowDelegate to draw the background and | 48 // overkill. Just use WindowDelegate to draw the background and |
| 49 // remove dependency to ui/views. | 49 // remove dependency to ui/views. |
| 50 | 50 |
| 51 views::Widget* background_widget = new views::Widget; | 51 views::Widget* background_widget = new views::Widget; |
| 52 views::Widget::InitParams params( | 52 views::Widget::InitParams params( |
| 53 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 53 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 54 params.accept_events = false; |
| 54 params.parent = container; | 55 params.parent = container; |
| 55 background_widget->Init(params); | 56 background_widget->Init(params); |
| 56 background_widget->GetNativeWindow()->layer()->SetMasksToBounds(true); | 57 background_widget->GetNativeWindow()->layer()->SetMasksToBounds(true); |
| 57 background_view_ = new BackgroundView; | 58 background_view_ = new BackgroundView; |
| 58 background_widget->SetContentsView(background_view_); | 59 background_widget->SetContentsView(background_view_); |
| 60 background_widget->GetNativeView()->SetName("BackgroundWidget"); |
| 59 background_widget->Show(); | 61 background_widget->Show(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 BackgroundController::~BackgroundController() { | 64 BackgroundController::~BackgroundController() { |
| 63 // background_widget is owned by the container and will be deleted | 65 // background_widget is owned by the container and will be deleted |
| 64 // when the container is deleted. | 66 // when the container is deleted. |
| 65 } | 67 } |
| 66 | 68 |
| 67 void BackgroundController::SetImage(const gfx::ImageSkia& image) { | 69 void BackgroundController::SetImage(const gfx::ImageSkia& image) { |
| 68 // TODO(oshima): implement cross fede animation. | 70 // TODO(oshima): implement cross fede animation. |
| 69 background_view_->SetImage(image); | 71 background_view_->SetImage(image); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace athena | 74 } // namespace athena |
| OLD | NEW |