OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/workspace/system_background_controller.h" | 5 #include "ash/wm/workspace/system_background_controller.h" |
6 | 6 |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ui/aura/client/aura_constants.h" |
8 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
9 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
10 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
11 #include "ui/views/widget/widget_delegate.h" | 12 #include "ui/views/widget/widget_delegate.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 // View implementation responsible for rendering the background. | 17 // View implementation responsible for rendering the background. |
17 class SystemBackgroundController::View : public views::WidgetDelegateView { | 18 class SystemBackgroundController::View : public views::WidgetDelegateView { |
(...skipping 24 matching lines...) Expand all Loading... |
42 | 43 |
43 void SystemBackgroundController::View::Close() { | 44 void SystemBackgroundController::View::Close() { |
44 controller_ = NULL; | 45 controller_ = NULL; |
45 GetWidget()->Close(); | 46 GetWidget()->Close(); |
46 } | 47 } |
47 | 48 |
48 views::View* SystemBackgroundController::View::GetContentsView() { | 49 views::View* SystemBackgroundController::View::GetContentsView() { |
49 return this; | 50 return this; |
50 } | 51 } |
51 | 52 |
52 SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root) | 53 SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root, |
| 54 SkColor color) |
53 : ALLOW_THIS_IN_INITIALIZER_LIST(view_(new View(this))) { | 55 : ALLOW_THIS_IN_INITIALIZER_LIST(view_(new View(this))) { |
54 views::Widget* widget = new views::Widget; | 56 views::Widget* widget = new views::Widget; |
55 views::Widget::InitParams params( | 57 views::Widget::InitParams params( |
56 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 58 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
57 params.delegate = view_; | 59 params.delegate = view_; |
58 params.parent = root->GetChildById(kShellWindowId_SystemBackgroundContainer); | 60 params.parent = root->GetChildById(kShellWindowId_SystemBackgroundContainer); |
59 params.can_activate = false; | 61 params.can_activate = false; |
60 params.accept_events = false; | 62 params.accept_events = false; |
61 // WARNING: because of a bug using anything but a solid color here causes | 63 // WARNING: because of a bug using anything but a solid color here causes |
62 // flicker. | 64 // flicker. |
63 params.layer_type = ui::LAYER_SOLID_COLOR; | 65 params.layer_type = ui::LAYER_SOLID_COLOR; |
64 widget->Init(params); | 66 widget->Init(params); |
65 widget->GetNativeView()->layer()->SetColor(SK_ColorBLACK); | 67 widget->GetNativeView()->SetProperty(aura::client::kAnimationsDisabledKey, |
| 68 true); |
| 69 widget->GetNativeView()->layer()->SetColor(color); |
66 widget->SetBounds(params.parent->bounds()); | 70 widget->SetBounds(params.parent->bounds()); |
67 widget->Show(); | 71 widget->Show(); |
68 widget->GetNativeView()->SetName("SystemBackground"); | 72 widget->GetNativeView()->SetName("SystemBackground"); |
69 } | 73 } |
70 | 74 |
71 SystemBackgroundController::~SystemBackgroundController() { | 75 SystemBackgroundController::~SystemBackgroundController() { |
72 if (view_) | 76 if (view_) |
73 view_->Close(); | 77 view_->Close(); |
74 } | 78 } |
75 | 79 |
| 80 void SystemBackgroundController::SetColor(SkColor color) { |
| 81 if (view_) |
| 82 view_->GetWidget()->GetNativeView()->layer()->SetColor(color); |
| 83 } |
| 84 |
76 } // namespace internal | 85 } // namespace internal |
77 } // namespace ash | 86 } // namespace ash |
OLD | NEW |