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/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 CreateSpecialContainers(root_window); | 404 CreateSpecialContainers(root_window); |
405 | 405 |
406 stacking_controller_.reset(new internal::StackingController); | 406 stacking_controller_.reset(new internal::StackingController); |
407 | 407 |
408 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 408 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
409 root_window->SetLayoutManager(root_window_layout_); | 409 root_window->SetLayoutManager(root_window_layout_); |
410 | 410 |
411 if (delegate_.get()) | 411 if (delegate_.get()) |
412 status_widget_ = delegate_->CreateStatusArea(); | 412 status_widget_ = delegate_->CreateStatusArea(); |
413 if (!status_widget_) | |
414 status_widget_ = internal::CreateStatusArea(); | |
415 | 413 |
416 if (command_line->HasSwitch(switches::kAshUberTray)) { | 414 if (command_line->HasSwitch(switches::kAshUberTray)) { |
417 // TODO(sad): This is rather ugly at the moment. This is because we are | 415 // TODO(sad): This is rather ugly at the moment. This is because we are |
418 // supporting both the old and the new status bar at the same time. This | 416 // supporting both the old and the new status bar at the same time. This |
419 // will soon get better once the new one is ready and the old one goes out | 417 // will soon get better once the new one is ready and the old one goes out |
420 // the door. | 418 // the door. |
421 if (delegate_.get()) | |
422 status_widget_ = delegate_->CreateStatusArea(); | |
423 if (!status_widget_) | |
424 status_widget_ = internal::CreateStatusArea(); | |
425 status_widget_->GetContentsView()->RemoveAllChildViews(false); | |
426 tray_.reset(new SystemTray()); | 419 tray_.reset(new SystemTray()); |
427 status_widget_->GetContentsView()->AddChildView(tray_.get()); | 420 if (status_widget_) { |
| 421 status_widget_->GetContentsView()->RemoveAllChildViews(false); |
| 422 status_widget_->GetContentsView()->AddChildView(tray_.get()); |
| 423 } |
428 | 424 |
429 if (delegate_.get()) | 425 if (delegate_.get()) |
430 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | 426 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
431 if (!tray_delegate_.get()) | 427 if (!tray_delegate_.get()) |
432 tray_delegate_.reset(new DummySystemTrayDelegate()); | 428 tray_delegate_.reset(new DummySystemTrayDelegate()); |
433 | 429 |
434 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 430 internal::TrayVolume* tray_volume = new internal::TrayVolume(); |
435 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 431 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); |
436 internal::TrayPowerDate* tray_power_date = new internal::TrayPowerDate(); | 432 internal::TrayPowerDate* tray_power_date = new internal::TrayPowerDate(); |
437 audio_controller_ = tray_volume; | 433 audio_controller_ = tray_volume; |
438 brightness_controller_ = tray_brightness; | 434 brightness_controller_ = tray_brightness; |
439 power_status_controller_ = tray_power_date; | 435 power_status_controller_ = tray_power_date; |
440 | 436 |
441 tray_->AddTrayItem(new internal::TrayUser()); | 437 tray_->AddTrayItem(new internal::TrayUser()); |
442 tray_->AddTrayItem(tray_power_date); | 438 tray_->AddTrayItem(tray_power_date); |
443 tray_->AddTrayItem(tray_volume); | 439 tray_->AddTrayItem(tray_volume); |
444 tray_->AddTrayItem(tray_brightness); | 440 tray_->AddTrayItem(tray_brightness); |
445 tray_->AddTrayItem(new internal::TraySettings()); | 441 tray_->AddTrayItem(new internal::TraySettings()); |
446 } | 442 } |
| 443 if (!status_widget_) |
| 444 status_widget_ = internal::CreateStatusArea(tray_.get()); |
447 | 445 |
448 aura::Window* default_container = | 446 aura::Window* default_container = |
449 GetContainer(internal::kShellWindowId_DefaultContainer); | 447 GetContainer(internal::kShellWindowId_DefaultContainer); |
450 launcher_.reset(new Launcher(default_container)); | 448 launcher_.reset(new Launcher(default_container)); |
451 | 449 |
452 if (window_mode_ == MODE_COMPACT) | 450 if (window_mode_ == MODE_COMPACT) |
453 SetupCompactWindowMode(); | 451 SetupCompactWindowMode(); |
454 else | 452 else |
455 SetupNonCompactWindowMode(); | 453 SetupNonCompactWindowMode(); |
456 | 454 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 void Shell::ResetLayoutManager(int container_id) { | 672 void Shell::ResetLayoutManager(int container_id) { |
675 GetContainer(container_id)->SetLayoutManager(NULL); | 673 GetContainer(container_id)->SetLayoutManager(NULL); |
676 } | 674 } |
677 | 675 |
678 void Shell::DisableWorkspaceGridLayout() { | 676 void Shell::DisableWorkspaceGridLayout() { |
679 if (workspace_controller_.get()) | 677 if (workspace_controller_.get()) |
680 workspace_controller_->workspace_manager()->set_grid_size(0); | 678 workspace_controller_->workspace_manager()->set_grid_size(0); |
681 } | 679 } |
682 | 680 |
683 } // namespace ash | 681 } // namespace ash |
OLD | NEW |