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 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/focus_cycler.h" | 10 #include "ash/focus_cycler.h" |
11 #include "ash/launcher/launcher_delegate.h" | 11 #include "ash/launcher/launcher_delegate.h" |
12 #include "ash/launcher/launcher_model.h" | 12 #include "ash/launcher/launcher_model.h" |
13 #include "ash/launcher/launcher_navigator.h" | 13 #include "ash/launcher/launcher_navigator.h" |
14 #include "ash/launcher/launcher_view.h" | 14 #include "ash/launcher/launcher_view.h" |
| 15 #include "ash/root_window_controller.h" |
15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
16 #include "ash/shell_delegate.h" | 17 #include "ash/shell_delegate.h" |
17 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
18 #include "ash/wm/shelf_layout_manager.h" | 19 #include "ash/wm/shelf_layout_manager.h" |
19 #include "ash/wm/window_properties.h" | 20 #include "ash/wm/window_properties.h" |
20 #include "grit/ash_resources.h" | 21 #include "grit/ash_resources.h" |
| 22 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
22 #include "ui/aura/window_observer.h" | 24 #include "ui/aura/window_observer.h" |
23 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/compositor/layer.h" | 26 #include "ui/compositor/layer.h" |
25 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
26 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
27 #include "ui/views/accessible_pane_view.h" | 29 #include "ui/views/accessible_pane_view.h" |
28 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
29 #include "ui/views/widget/widget_delegate.h" | 31 #include "ui/views/widget/widget_delegate.h" |
30 | 32 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 widget_->set_focus_on_creation(false); | 233 widget_->set_focus_on_creation(false); |
232 widget_->SetContentsView(delegate_view_); | 234 widget_->SetContentsView(delegate_view_); |
233 widget_->GetNativeView()->SetName("LauncherView"); | 235 widget_->GetNativeView()->SetName("LauncherView"); |
234 widget_->GetNativeView()->SetProperty(internal::kStayInSameRootWindowKey, | 236 widget_->GetNativeView()->SetProperty(internal::kStayInSameRootWindowKey, |
235 true); | 237 true); |
236 } | 238 } |
237 | 239 |
238 Launcher::~Launcher() { | 240 Launcher::~Launcher() { |
239 } | 241 } |
240 | 242 |
| 243 // static |
| 244 Launcher* Launcher::ForPrimaryDisplay() { |
| 245 return internal::RootWindowController::ForLauncher( |
| 246 Shell::GetPrimaryRootWindow())->launcher(); |
| 247 } |
| 248 |
| 249 // static |
| 250 Launcher* Launcher::ForWindow(aura::Window* window) { |
| 251 return internal::RootWindowController::ForLauncher(window)->launcher(); |
| 252 } |
| 253 |
241 void Launcher::SetFocusCycler(internal::FocusCycler* focus_cycler) { | 254 void Launcher::SetFocusCycler(internal::FocusCycler* focus_cycler) { |
242 delegate_view_->set_focus_cycler(focus_cycler); | 255 delegate_view_->set_focus_cycler(focus_cycler); |
243 focus_cycler->AddWidget(widget_.get()); | 256 focus_cycler->AddWidget(widget_.get()); |
244 } | 257 } |
245 | 258 |
246 internal::FocusCycler* Launcher::GetFocusCycler() { | 259 internal::FocusCycler* Launcher::GetFocusCycler() { |
247 return delegate_view_->focus_cycler(); | 260 return delegate_view_->focus_cycler(); |
248 } | 261 } |
249 | 262 |
250 void Launcher::SetAlignment(ShelfAlignment alignment) { | 263 void Launcher::SetAlignment(ShelfAlignment alignment) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 widget_->SetBounds(bounds); | 376 widget_->SetBounds(bounds); |
364 if (dimmer_.get()) | 377 if (dimmer_.get()) |
365 dimmer_->SetBounds(bounds); | 378 dimmer_->SetBounds(bounds); |
366 } | 379 } |
367 | 380 |
368 internal::LauncherView* Launcher::GetLauncherViewForTest() { | 381 internal::LauncherView* Launcher::GetLauncherViewForTest() { |
369 return launcher_view_; | 382 return launcher_view_; |
370 } | 383 } |
371 | 384 |
372 } // namespace ash | 385 } // namespace ash |
OLD | NEW |