Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: ash/shell.cc

Issue 9701098: MultiMonitor support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ash/desktop_background/desktop_background_controller.h" 11 #include "ash/desktop_background/desktop_background_controller.h"
12 #include "ash/desktop_background/desktop_background_resources.h" 12 #include "ash/desktop_background/desktop_background_resources.h"
13 #include "ash/desktop_background/desktop_background_view.h" 13 #include "ash/desktop_background/desktop_background_view.h"
14 #include "ash/drag_drop/drag_drop_controller.h" 14 #include "ash/drag_drop/drag_drop_controller.h"
15 #include "ash/focus_cycler.h" 15 #include "ash/focus_cycler.h"
16 #include "ash/ime/input_method_event_filter.h" 16 #include "ash/ime/input_method_event_filter.h"
17 #include "ash/launcher/launcher.h" 17 #include "ash/launcher/launcher.h"
18 #include "ash/monitor/multi_monitor_manager.h"
19 #include "ash/monitor/monitor_controller.h"
18 #include "ash/screen_ash.h" 20 #include "ash/screen_ash.h"
19 #include "ash/shell_delegate.h" 21 #include "ash/shell_delegate.h"
20 #include "ash/shell_factory.h" 22 #include "ash/shell_factory.h"
21 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
22 #include "ash/system/audio/tray_volume.h" 24 #include "ash/system/audio/tray_volume.h"
23 #include "ash/system/brightness/tray_brightness.h" 25 #include "ash/system/brightness/tray_brightness.h"
24 #include "ash/system/network/tray_network.h" 26 #include "ash/system/network/tray_network.h"
25 #include "ash/system/power/power_status_observer.h" 27 #include "ash/system/power/power_status_observer.h"
26 #include "ash/system/power/power_supply_status.h" 28 #include "ash/system/power/power_supply_status.h"
27 #include "ash/system/power/tray_power_date.h" 29 #include "ash/system/power/tray_power_date.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 : root_window_(aura::Env::GetInstance()->monitor_manager()-> 401 : root_window_(aura::Env::GetInstance()->monitor_manager()->
400 CreateRootWindowForPrimaryMonitor()), 402 CreateRootWindowForPrimaryMonitor()),
401 screen_(new ScreenAsh(root_window_.get())), 403 screen_(new ScreenAsh(root_window_.get())),
402 root_filter_(NULL), 404 root_filter_(NULL),
403 delegate_(delegate), 405 delegate_(delegate),
404 shelf_(NULL), 406 shelf_(NULL),
405 root_window_layout_(NULL), 407 root_window_layout_(NULL),
406 status_widget_(NULL) { 408 status_widget_(NULL) {
407 gfx::Screen::SetInstance(screen_); 409 gfx::Screen::SetInstance(screen_);
408 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); 410 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get()));
409 aura::Env::GetInstance()->monitor_manager()->AddObserver(this);
410 } 411 }
411 412
412 Shell::~Shell() { 413 Shell::~Shell() {
413 aura::Env::GetInstance()->monitor_manager()->RemoveObserver(this);
414 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); 414 RemoveRootWindowEventFilter(partial_screenshot_filter_.get());
415 RemoveRootWindowEventFilter(input_method_filter_.get()); 415 RemoveRootWindowEventFilter(input_method_filter_.get());
416 RemoveRootWindowEventFilter(window_modality_controller_.get()); 416 RemoveRootWindowEventFilter(window_modality_controller_.get());
417 #if !defined(OS_MACOSX) 417 #if !defined(OS_MACOSX)
418 RemoveRootWindowEventFilter(accelerator_filter_.get()); 418 RemoveRootWindowEventFilter(accelerator_filter_.get());
419 #endif 419 #endif
420 420
421 // Close background widget now so that the focus manager of the 421 // Close background widget now so that the focus manager of the
422 // widget gets deleted in the final message loop run. 422 // widget gets deleted in the final message loop run.
423 root_window_layout_->SetBackgroundWidget(NULL); 423 root_window_layout_->SetBackgroundWidget(NULL);
(...skipping 18 matching lines...) Expand all
442 } 442 }
443 443
444 // These need a valid Shell instance to clean up properly, so explicitly 444 // These need a valid Shell instance to clean up properly, so explicitly
445 // delete them before invalidating the instance. 445 // delete them before invalidating the instance.
446 // Alphabetical. 446 // Alphabetical.
447 activation_controller_.reset(); 447 activation_controller_.reset();
448 drag_drop_controller_.reset(); 448 drag_drop_controller_.reset();
449 resize_shadow_controller_.reset(); 449 resize_shadow_controller_.reset();
450 shadow_controller_.reset(); 450 shadow_controller_.reset();
451 window_cycle_controller_.reset(); 451 window_cycle_controller_.reset();
452 monitor_controller_.reset();
452 453
453 // Launcher widget has a InputMethodBridge that references to 454 // Launcher widget has a InputMethodBridge that references to
454 // input_method_filter_'s input_method_. So explicitly release launcher_ 455 // input_method_filter_'s input_method_. So explicitly release launcher_
455 // before input_method_filter_. And this needs to be after we delete all 456 // before input_method_filter_. And this needs to be after we delete all
456 // containers in case there are still live browser windows which access 457 // containers in case there are still live browser windows which access
457 // LauncherModel during close. 458 // LauncherModel during close.
458 launcher_.reset(); 459 launcher_.reset();
459 460
460 DCHECK(instance_ == this); 461 DCHECK(instance_ == this);
461 instance_ = NULL; 462 instance_ = NULL;
462 } 463 }
463 464
464 // static 465 // static
465 Shell* Shell::CreateInstance(ShellDelegate* delegate) { 466 Shell* Shell::CreateInstance(ShellDelegate* delegate) {
466 CHECK(!instance_); 467 CHECK(!instance_);
468 aura::Env::GetInstance()->SetMonitorManager(
469 new internal::MultiMonitorManager());
467 instance_ = new Shell(delegate); 470 instance_ = new Shell(delegate);
468 instance_->Init(); 471 instance_->Init();
469 return instance_; 472 return instance_;
470 } 473 }
471 474
472 // static 475 // static
473 Shell* Shell::GetInstance() { 476 Shell* Shell::GetInstance() {
474 DCHECK(instance_); 477 DCHECK(instance_);
475 return instance_; 478 return instance_;
476 } 479 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 613
611 visibility_controller_.reset(new internal::VisibilityController); 614 visibility_controller_.reset(new internal::VisibilityController);
612 615
613 tooltip_controller_.reset(new internal::TooltipController); 616 tooltip_controller_.reset(new internal::TooltipController);
614 AddRootWindowEventFilter(tooltip_controller_.get()); 617 AddRootWindowEventFilter(tooltip_controller_.get());
615 618
616 drag_drop_controller_.reset(new internal::DragDropController); 619 drag_drop_controller_.reset(new internal::DragDropController);
617 power_button_controller_.reset(new PowerButtonController); 620 power_button_controller_.reset(new PowerButtonController);
618 video_detector_.reset(new VideoDetector); 621 video_detector_.reset(new VideoDetector);
619 window_cycle_controller_.reset(new WindowCycleController); 622 window_cycle_controller_.reset(new WindowCycleController);
623 monitor_controller_.reset(new internal::MonitorController);
620 } 624 }
621 625
622 aura::Window* Shell::GetContainer(int container_id) { 626 aura::Window* Shell::GetContainer(int container_id) {
623 return const_cast<aura::Window*>( 627 return const_cast<aura::Window*>(
624 const_cast<const Shell*>(this)->GetContainer(container_id)); 628 const_cast<const Shell*>(this)->GetContainer(container_id));
625 } 629 }
626 630
627 const aura::Window* Shell::GetContainer(int container_id) const { 631 const aura::Window* Shell::GetContainer(int container_id) const {
628 return GetRootWindow()->GetChildById(container_id); 632 return GetRootWindow()->GetChildById(container_id);
629 } 633 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 706
703 void Shell::RemoveShellObserver(ShellObserver* observer) { 707 void Shell::RemoveShellObserver(ShellObserver* observer) {
704 observers_.RemoveObserver(observer); 708 observers_.RemoveObserver(observer);
705 } 709 }
706 710
707 int Shell::GetGridSize() const { 711 int Shell::GetGridSize() const {
708 return workspace_controller_->workspace_manager()->grid_size(); 712 return workspace_controller_->workspace_manager()->grid_size();
709 } 713 }
710 714
711 //////////////////////////////////////////////////////////////////////////////// 715 ////////////////////////////////////////////////////////////////////////////////
712 // Shell, aura::MonitorObserver implementation:
713
714 void Shell::OnMonitorBoundsChanged(const aura::Monitor* monitor) {
715 if (aura::RootWindow::use_fullscreen_host_window())
716 root_window_->SetHostSize(monitor->size());
717 }
718
719 ////////////////////////////////////////////////////////////////////////////////
720 // Shell, private: 716 // Shell, private:
721 717
722 void Shell::InitLayoutManagers() { 718 void Shell::InitLayoutManagers() {
723 DCHECK(root_window_layout_); 719 DCHECK(root_window_layout_);
724 DCHECK(status_widget_); 720 DCHECK(status_widget_);
725 721
726 internal::ShelfLayoutManager* shelf_layout_manager = 722 internal::ShelfLayoutManager* shelf_layout_manager =
727 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); 723 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_);
728 GetContainer(internal::kShellWindowId_LauncherContainer)-> 724 GetContainer(internal::kShellWindowId_LauncherContainer)->
729 SetLayoutManager(shelf_layout_manager); 725 SetLayoutManager(shelf_layout_manager);
(...skipping 17 matching lines...) Expand all
747 // Create the desktop background image. 743 // Create the desktop background image.
748 desktop_background_controller_->SetDefaultDesktopBackgroundImage(); 744 desktop_background_controller_->SetDefaultDesktopBackgroundImage();
749 } 745 }
750 746
751 void Shell::DisableWorkspaceGridLayout() { 747 void Shell::DisableWorkspaceGridLayout() {
752 if (workspace_controller_.get()) 748 if (workspace_controller_.get())
753 workspace_controller_->workspace_manager()->set_grid_size(0); 749 workspace_controller_->workspace_manager()->set_grid_size(0);
754 } 750 }
755 751
756 } // namespace ash 752 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698