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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/focus_cycler.h" | 9 #include "ash/focus_cycler.h" |
10 #include "ash/launcher/launcher_delegate.h" | 10 #include "ash/launcher/launcher_delegate.h" |
11 #include "ash/launcher/launcher_model.h" | 11 #include "ash/launcher/launcher_model.h" |
12 #include "ash/launcher/launcher_navigator.h" | 12 #include "ash/launcher/launcher_navigator.h" |
13 #include "ash/launcher/launcher_view.h" | 13 #include "ash/launcher/launcher_view.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
17 #include "ash/wm/shelf_layout_manager.h" | 17 #include "ash/wm/shelf_layout_manager.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
22 #include "ui/views/accessible_pane_view.h" | 22 #include "ui/views/accessible_pane_view.h" |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 #include "ui/views/widget/widget_delegate.h" | 24 #include "ui/views/widget/widget_delegate.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 namespace { | |
29 | |
30 // Max alpha of the background. | |
31 const int kBackgroundAlpha = 128; | |
32 | |
33 } | |
34 | |
35 // The contents view of the Widget. This view contains LauncherView and | 28 // The contents view of the Widget. This view contains LauncherView and |
36 // sizes it to the width of the widget minus the size of the status area. | 29 // sizes it to the width of the widget minus the size of the status area. |
37 class Launcher::DelegateView : public views::WidgetDelegate, | 30 class Launcher::DelegateView : public views::WidgetDelegate, |
38 public views::AccessiblePaneView { | 31 public views::AccessiblePaneView { |
39 public: | 32 public: |
40 explicit DelegateView(Launcher* launcher); | 33 explicit DelegateView(Launcher* launcher); |
41 virtual ~DelegateView(); | 34 virtual ~DelegateView(); |
42 | 35 |
43 void set_focus_cycler(internal::FocusCycler* focus_cycler) { | 36 void set_focus_cycler(internal::FocusCycler* focus_cycler) { |
44 focus_cycler_ = focus_cycler; | 37 focus_cycler_ = focus_cycler; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Launcher -------------------------------------------------------------------- | 91 // Launcher -------------------------------------------------------------------- |
99 | 92 |
100 Launcher::Launcher(aura::Window* window_container, | 93 Launcher::Launcher(aura::Window* window_container, |
101 internal::ShelfLayoutManager* shelf_layout_manager) | 94 internal::ShelfLayoutManager* shelf_layout_manager) |
102 : widget_(NULL), | 95 : widget_(NULL), |
103 window_container_(window_container), | 96 window_container_(window_container), |
104 delegate_view_(NULL), | 97 delegate_view_(NULL), |
105 launcher_view_(NULL), | 98 launcher_view_(NULL), |
106 alignment_(SHELF_ALIGNMENT_BOTTOM), | 99 alignment_(SHELF_ALIGNMENT_BOTTOM), |
107 ALLOW_THIS_IN_INITIALIZER_LIST( | 100 ALLOW_THIS_IN_INITIALIZER_LIST( |
108 background_animator_(this, 0, kBackgroundAlpha)) { | 101 background_animator_(this, 0, kLauncherBackgroundAlpha)) { |
109 model_.reset(new LauncherModel); | 102 model_.reset(new LauncherModel); |
110 if (Shell::GetInstance()->delegate()) { | 103 if (Shell::GetInstance()->delegate()) { |
111 delegate_.reset( | 104 delegate_.reset( |
112 Shell::GetInstance()->delegate()->CreateLauncherDelegate(model_.get())); | 105 Shell::GetInstance()->delegate()->CreateLauncherDelegate(model_.get())); |
113 } | 106 } |
114 | 107 |
115 widget_.reset(new views::Widget); | 108 widget_.reset(new views::Widget); |
116 views::Widget::InitParams params( | 109 views::Widget::InitParams params( |
117 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 110 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
118 // The launcher only ever draws a solid color. | 111 // The launcher only ever draws a solid color. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 internal::LauncherView* Launcher::GetLauncherViewForTest() { | 220 internal::LauncherView* Launcher::GetLauncherViewForTest() { |
228 return launcher_view_; | 221 return launcher_view_; |
229 } | 222 } |
230 | 223 |
231 void Launcher::UpdateBackground(int alpha) { | 224 void Launcher::UpdateBackground(int alpha) { |
232 ui::Layer* layer = widget_->GetNativeView()->layer(); | 225 ui::Layer* layer = widget_->GetNativeView()->layer(); |
233 layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0)); | 226 layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0)); |
234 } | 227 } |
235 | 228 |
236 } // namespace ash | 229 } // namespace ash |
OLD | NEW |