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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
10 #include "ash/accelerators/accelerator_filter.h" | 10 #include "ash/accelerators/accelerator_filter.h" |
11 #include "ash/app_list/app_list.h" | 11 #include "ash/app_list/app_list.h" |
12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
13 #include "ash/drag_drop/drag_drop_controller.h" | 13 #include "ash/drag_drop/drag_drop_controller.h" |
| 14 #include "ash/focus_cycler.h" |
14 #include "ash/ime/input_method_event_filter.h" | 15 #include "ash/ime/input_method_event_filter.h" |
15 #include "ash/launcher/launcher.h" | 16 #include "ash/launcher/launcher.h" |
16 #include "ash/shell_delegate.h" | 17 #include "ash/shell_delegate.h" |
17 #include "ash/shell_factory.h" | 18 #include "ash/shell_factory.h" |
18 #include "ash/shell_window_ids.h" | 19 #include "ash/shell_window_ids.h" |
19 #include "ash/tooltips/tooltip_controller.h" | 20 #include "ash/tooltips/tooltip_controller.h" |
20 #include "ash/wm/activation_controller.h" | 21 #include "ash/wm/activation_controller.h" |
21 #include "ash/wm/base_layout_manager.h" | 22 #include "ash/wm/base_layout_manager.h" |
22 #include "ash/wm/compact_layout_manager.h" | 23 #include "ash/wm/compact_layout_manager.h" |
23 #include "ash/wm/compact_status_area_layout_manager.h" | 24 #include "ash/wm/compact_status_area_layout_manager.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 launcher_.reset(new Launcher(default_container)); | 305 launcher_.reset(new Launcher(default_container)); |
305 | 306 |
306 if (window_mode_ == MODE_COMPACT) | 307 if (window_mode_ == MODE_COMPACT) |
307 SetupCompactWindowMode(); | 308 SetupCompactWindowMode(); |
308 else | 309 else |
309 SetupNonCompactWindowMode(); | 310 SetupNonCompactWindowMode(); |
310 | 311 |
311 if (!command_line->HasSwitch(switches::kAuraNoShadows)) | 312 if (!command_line->HasSwitch(switches::kAuraNoShadows)) |
312 shadow_controller_.reset(new internal::ShadowController()); | 313 shadow_controller_.reset(new internal::ShadowController()); |
313 | 314 |
| 315 focus_cycler_.reset(new internal::FocusCycler()); |
| 316 focus_cycler_->AddWidget(status_widget_); |
| 317 focus_cycler_->AddWidget(launcher_->widget()); |
| 318 |
314 // Force a layout. | 319 // Force a layout. |
315 root_window->layout_manager()->OnWindowResized(); | 320 root_window->layout_manager()->OnWindowResized(); |
316 | 321 |
317 window_modality_controller_.reset(new internal::WindowModalityController); | 322 window_modality_controller_.reset(new internal::WindowModalityController); |
318 AddRootWindowEventFilter(window_modality_controller_.get()); | 323 AddRootWindowEventFilter(window_modality_controller_.get()); |
319 | 324 |
320 visibility_controller_.reset(new internal::VisibilityController); | 325 visibility_controller_.reset(new internal::VisibilityController); |
321 aura::client::SetVisibilityClient(visibility_controller_.get()); | 326 aura::client::SetVisibilityClient(visibility_controller_.get()); |
322 | 327 |
323 accelerator_filter_.reset(new internal::AcceleratorFilter); | 328 accelerator_filter_.reset(new internal::AcceleratorFilter); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 433 |
429 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( | 434 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( |
430 views::Widget* widget) { | 435 views::Widget* widget) { |
431 if (CommandLine::ForCurrentProcess()->HasSwitch( | 436 if (CommandLine::ForCurrentProcess()->HasSwitch( |
432 switches::kAuraGoogleDialogFrames)) { | 437 switches::kAuraGoogleDialogFrames)) { |
433 return new internal::DialogFrameView; | 438 return new internal::DialogFrameView; |
434 } | 439 } |
435 return NULL; | 440 return NULL; |
436 } | 441 } |
437 | 442 |
| 443 void Shell::RotateFocus(Direction direction) { |
| 444 focus_cycler_->RotateFocus( |
| 445 direction == FORWARD ? internal::FocusCycler::FORWARD : |
| 446 internal::FocusCycler::BACKWARD); |
| 447 } |
| 448 |
438 //////////////////////////////////////////////////////////////////////////////// | 449 //////////////////////////////////////////////////////////////////////////////// |
439 // Shell, private: | 450 // Shell, private: |
440 | 451 |
441 // Compact mode has a simplified layout manager and doesn't use the shelf, | 452 // Compact mode has a simplified layout manager and doesn't use the shelf, |
442 // desktop background, etc. The launcher still exists so we can use its | 453 // desktop background, etc. The launcher still exists so we can use its |
443 // data model and list of open windows, but we hide the UI to save space. | 454 // data model and list of open windows, but we hide the UI to save space. |
444 void Shell::SetupCompactWindowMode() { | 455 void Shell::SetupCompactWindowMode() { |
445 DCHECK(root_window_layout_); | 456 DCHECK(root_window_layout_); |
446 DCHECK(status_widget_); | 457 DCHECK(status_widget_); |
447 | 458 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 532 |
522 // Create the desktop background image. | 533 // Create the desktop background image. |
523 root_window_layout_->SetBackgroundWidget(internal::CreateDesktopBackground()); | 534 root_window_layout_->SetBackgroundWidget(internal::CreateDesktopBackground()); |
524 } | 535 } |
525 | 536 |
526 void Shell::ResetLayoutManager(int container_id) { | 537 void Shell::ResetLayoutManager(int container_id) { |
527 GetContainer(container_id)->SetLayoutManager(NULL); | 538 GetContainer(container_id)->SetLayoutManager(NULL); |
528 } | 539 } |
529 | 540 |
530 } // namespace ash | 541 } // namespace ash |
OLD | NEW |