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

Side by Side Diff: ash/shell.cc

Issue 9701098: MultiMonitor support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix 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
« no previous file with comments | « ash/shell.h ('k') | chrome/browser/chrome_browser_main_extra_parts_ash.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ime/tray_ime.h" 26 #include "ash/system/ime/tray_ime.h"
25 #include "ash/system/network/tray_network.h" 27 #include "ash/system/network/tray_network.h"
26 #include "ash/system/power/power_status_observer.h" 28 #include "ash/system/power/power_status_observer.h"
27 #include "ash/system/power/power_supply_status.h" 29 #include "ash/system/power/power_supply_status.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 404 }
403 405
404 internal::WorkspaceController* Shell::TestApi::workspace_controller() { 406 internal::WorkspaceController* Shell::TestApi::workspace_controller() {
405 return shell_->workspace_controller_.get(); 407 return shell_->workspace_controller_.get();
406 } 408 }
407 409
408 //////////////////////////////////////////////////////////////////////////////// 410 ////////////////////////////////////////////////////////////////////////////////
409 // Shell, public: 411 // Shell, public:
410 412
411 Shell::Shell(ShellDelegate* delegate) 413 Shell::Shell(ShellDelegate* delegate)
412 : root_window_(aura::Env::GetInstance()->monitor_manager()-> 414 : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()),
413 CreateRootWindowForPrimaryMonitor()),
414 screen_(new ScreenAsh(root_window_.get())), 415 screen_(new ScreenAsh(root_window_.get())),
415 root_filter_(NULL), 416 root_filter_(NULL),
416 delegate_(delegate), 417 delegate_(delegate),
417 shelf_(NULL), 418 shelf_(NULL),
418 root_window_layout_(NULL), 419 root_window_layout_(NULL),
419 status_widget_(NULL) { 420 status_widget_(NULL) {
420 gfx::Screen::SetInstance(screen_); 421 gfx::Screen::SetInstance(screen_);
421 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); 422 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get()));
422 aura::Env::GetInstance()->monitor_manager()->AddObserver(this);
423 } 423 }
424 424
425 Shell::~Shell() { 425 Shell::~Shell() {
426 aura::Env::GetInstance()->monitor_manager()->RemoveObserver(this);
427 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); 426 RemoveRootWindowEventFilter(partial_screenshot_filter_.get());
428 RemoveRootWindowEventFilter(input_method_filter_.get()); 427 RemoveRootWindowEventFilter(input_method_filter_.get());
429 RemoveRootWindowEventFilter(window_modality_controller_.get()); 428 RemoveRootWindowEventFilter(window_modality_controller_.get());
430 #if !defined(OS_MACOSX) 429 #if !defined(OS_MACOSX)
431 RemoveRootWindowEventFilter(accelerator_filter_.get()); 430 RemoveRootWindowEventFilter(accelerator_filter_.get());
432 #endif 431 #endif
433 432
434 // Close background widget now so that the focus manager of the 433 // Close background widget now so that the focus manager of the
435 // widget gets deleted in the final message loop run. 434 // widget gets deleted in the final message loop run.
436 root_window_layout_->SetBackgroundWidget(NULL); 435 root_window_layout_->SetBackgroundWidget(NULL);
(...skipping 18 matching lines...) Expand all
455 } 454 }
456 455
457 // These need a valid Shell instance to clean up properly, so explicitly 456 // These need a valid Shell instance to clean up properly, so explicitly
458 // delete them before invalidating the instance. 457 // delete them before invalidating the instance.
459 // Alphabetical. 458 // Alphabetical.
460 activation_controller_.reset(); 459 activation_controller_.reset();
461 drag_drop_controller_.reset(); 460 drag_drop_controller_.reset();
462 resize_shadow_controller_.reset(); 461 resize_shadow_controller_.reset();
463 shadow_controller_.reset(); 462 shadow_controller_.reset();
464 window_cycle_controller_.reset(); 463 window_cycle_controller_.reset();
464 monitor_controller_.reset();
465 465
466 // Launcher widget has a InputMethodBridge that references to 466 // Launcher widget has a InputMethodBridge that references to
467 // input_method_filter_'s input_method_. So explicitly release launcher_ 467 // input_method_filter_'s input_method_. So explicitly release launcher_
468 // before input_method_filter_. And this needs to be after we delete all 468 // before input_method_filter_. And this needs to be after we delete all
469 // containers in case there are still live browser windows which access 469 // containers in case there are still live browser windows which access
470 // LauncherModel during close. 470 // LauncherModel during close.
471 launcher_.reset(); 471 launcher_.reset();
472 472
473 DCHECK(instance_ == this); 473 DCHECK(instance_ == this);
474 instance_ = NULL; 474 instance_ = NULL;
475 } 475 }
476 476
477 // static 477 // static
478 Shell* Shell::CreateInstance(ShellDelegate* delegate) { 478 Shell* Shell::CreateInstance(ShellDelegate* delegate) {
479 CHECK(!instance_); 479 CHECK(!instance_);
480 aura::Env::GetInstance()->SetMonitorManager(
481 new internal::MultiMonitorManager());
480 instance_ = new Shell(delegate); 482 instance_ = new Shell(delegate);
481 instance_->Init(); 483 instance_->Init();
482 return instance_; 484 return instance_;
483 } 485 }
484 486
485 // static 487 // static
486 Shell* Shell::GetInstance() { 488 Shell* Shell::GetInstance() {
487 DCHECK(instance_); 489 DCHECK(instance_);
488 return instance_; 490 return instance_;
489 } 491 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 629
628 visibility_controller_.reset(new internal::VisibilityController); 630 visibility_controller_.reset(new internal::VisibilityController);
629 631
630 tooltip_controller_.reset(new internal::TooltipController); 632 tooltip_controller_.reset(new internal::TooltipController);
631 AddRootWindowEventFilter(tooltip_controller_.get()); 633 AddRootWindowEventFilter(tooltip_controller_.get());
632 634
633 drag_drop_controller_.reset(new internal::DragDropController); 635 drag_drop_controller_.reset(new internal::DragDropController);
634 power_button_controller_.reset(new PowerButtonController); 636 power_button_controller_.reset(new PowerButtonController);
635 video_detector_.reset(new VideoDetector); 637 video_detector_.reset(new VideoDetector);
636 window_cycle_controller_.reset(new WindowCycleController); 638 window_cycle_controller_.reset(new WindowCycleController);
639 monitor_controller_.reset(new internal::MonitorController);
637 } 640 }
638 641
639 aura::Window* Shell::GetContainer(int container_id) { 642 aura::Window* Shell::GetContainer(int container_id) {
640 return const_cast<aura::Window*>( 643 return const_cast<aura::Window*>(
641 const_cast<const Shell*>(this)->GetContainer(container_id)); 644 const_cast<const Shell*>(this)->GetContainer(container_id));
642 } 645 }
643 646
644 const aura::Window* Shell::GetContainer(int container_id) const { 647 const aura::Window* Shell::GetContainer(int container_id) const {
645 return GetRootWindow()->GetChildById(container_id); 648 return GetRootWindow()->GetChildById(container_id);
646 } 649 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 722
720 void Shell::RemoveShellObserver(ShellObserver* observer) { 723 void Shell::RemoveShellObserver(ShellObserver* observer) {
721 observers_.RemoveObserver(observer); 724 observers_.RemoveObserver(observer);
722 } 725 }
723 726
724 int Shell::GetGridSize() const { 727 int Shell::GetGridSize() const {
725 return workspace_controller_->workspace_manager()->grid_size(); 728 return workspace_controller_->workspace_manager()->grid_size();
726 } 729 }
727 730
728 //////////////////////////////////////////////////////////////////////////////// 731 ////////////////////////////////////////////////////////////////////////////////
729 // Shell, aura::MonitorObserver implementation:
730
731 void Shell::OnMonitorBoundsChanged(const aura::Monitor* monitor) {
732 if (aura::RootWindow::use_fullscreen_host_window())
733 root_window_->SetHostSize(monitor->size());
734 }
735
736 ////////////////////////////////////////////////////////////////////////////////
737 // Shell, private: 732 // Shell, private:
738 733
739 void Shell::InitLayoutManagers() { 734 void Shell::InitLayoutManagers() {
740 DCHECK(root_window_layout_); 735 DCHECK(root_window_layout_);
741 DCHECK(status_widget_); 736 DCHECK(status_widget_);
742 737
743 internal::ShelfLayoutManager* shelf_layout_manager = 738 internal::ShelfLayoutManager* shelf_layout_manager =
744 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); 739 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_);
745 GetContainer(internal::kShellWindowId_LauncherContainer)-> 740 GetContainer(internal::kShellWindowId_LauncherContainer)->
746 SetLayoutManager(shelf_layout_manager); 741 SetLayoutManager(shelf_layout_manager);
(...skipping 17 matching lines...) Expand all
764 // Create the desktop background image. 759 // Create the desktop background image.
765 desktop_background_controller_->SetDefaultDesktopBackgroundImage(); 760 desktop_background_controller_->SetDefaultDesktopBackgroundImage();
766 } 761 }
767 762
768 void Shell::DisableWorkspaceGridLayout() { 763 void Shell::DisableWorkspaceGridLayout() {
769 if (workspace_controller_.get()) 764 if (workspace_controller_.get())
770 workspace_controller_->workspace_manager()->set_grid_size(0); 765 workspace_controller_->workspace_manager()->set_grid_size(0);
771 } 766 }
772 767
773 } // namespace ash 768 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | chrome/browser/chrome_browser_main_extra_parts_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698