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

Side by Side Diff: ash/shell.cc

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 7 years, 8 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.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 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
(...skipping 10 matching lines...) Expand all
21 #include "ash/drag_drop/drag_drop_controller.h" 21 #include "ash/drag_drop/drag_drop_controller.h"
22 #include "ash/focus_cycler.h" 22 #include "ash/focus_cycler.h"
23 #include "ash/high_contrast/high_contrast_controller.h" 23 #include "ash/high_contrast/high_contrast_controller.h"
24 #include "ash/host/root_window_host_factory.h" 24 #include "ash/host/root_window_host_factory.h"
25 #include "ash/launcher/launcher_delegate.h" 25 #include "ash/launcher/launcher_delegate.h"
26 #include "ash/launcher/launcher_model.h" 26 #include "ash/launcher/launcher_model.h"
27 #include "ash/magnifier/magnification_controller.h" 27 #include "ash/magnifier/magnification_controller.h"
28 #include "ash/magnifier/partial_magnification_controller.h" 28 #include "ash/magnifier/partial_magnification_controller.h"
29 #include "ash/root_window_controller.h" 29 #include "ash/root_window_controller.h"
30 #include "ash/screen_ash.h" 30 #include "ash/screen_ash.h"
31 #include "ash/session_state_delegate.h"
31 #include "ash/shelf/shelf_layout_manager.h" 32 #include "ash/shelf/shelf_layout_manager.h"
32 #include "ash/shelf/shelf_widget.h" 33 #include "ash/shelf/shelf_widget.h"
33 #include "ash/shell_delegate.h" 34 #include "ash/shell_delegate.h"
34 #include "ash/shell_factory.h" 35 #include "ash/shell_factory.h"
35 #include "ash/shell_window_ids.h" 36 #include "ash/shell_window_ids.h"
36 #include "ash/system/status_area_widget.h" 37 #include "ash/system/status_area_widget.h"
37 #include "ash/system/tray/system_tray_delegate.h" 38 #include "ash/system/tray/system_tray_delegate.h"
38 #include "ash/system/tray/system_tray_notifier.h" 39 #include "ash/system/tray/system_tray_notifier.h"
39 #include "ash/wm/activation_controller.h" 40 #include "ash/wm/activation_controller.h"
40 #include "ash/wm/always_on_top_controller.h" 41 #include "ash/wm/always_on_top_controller.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 553
553 // This controller needs to be set before SetupManagedWindowMode. 554 // This controller needs to be set before SetupManagedWindowMode.
554 desktop_background_controller_.reset(new DesktopBackgroundController()); 555 desktop_background_controller_.reset(new DesktopBackgroundController());
555 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); 556 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate());
556 if (!user_wallpaper_delegate_.get()) 557 if (!user_wallpaper_delegate_.get())
557 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); 558 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate());
558 559
559 // StatusAreaWidget uses Shell's CapsLockDelegate. 560 // StatusAreaWidget uses Shell's CapsLockDelegate.
560 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); 561 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate());
561 562
563 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate());
564
562 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { 565 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) {
563 resize_shadow_controller_.reset(new internal::ResizeShadowController()); 566 resize_shadow_controller_.reset(new internal::ResizeShadowController());
564 shadow_controller_.reset( 567 shadow_controller_.reset(
565 new views::corewm::ShadowController(activation_client_)); 568 new views::corewm::ShadowController(activation_client_));
566 } 569 }
567 570
568 // Create system_tray_notifier_ before the delegate. 571 // Create system_tray_notifier_ before the delegate.
569 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); 572 system_tray_notifier_.reset(new ash::SystemTrayNotifier());
570 573
571 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. 574 // Initialize system_tray_delegate_ before initializing StatusAreaWidget.
(...skipping 23 matching lines...) Expand all
595 cursor_manager_.SetCursor(ui::kCursorPointer); 598 cursor_manager_.SetCursor(ui::kCursorPointer);
596 599
597 if (!cursor_manager_.IsCursorVisible()) { 600 if (!cursor_manager_.IsCursorVisible()) {
598 // Cursor might have been hidden by something other than chrome. 601 // Cursor might have been hidden by something other than chrome.
599 // Let the first mouse event show the cursor. 602 // Let the first mouse event show the cursor.
600 env_filter_->set_cursor_hidden_by_filter(true); 603 env_filter_->set_cursor_hidden_by_filter(true);
601 } 604 }
602 } 605 }
603 606
604 void Shell::ShowContextMenu(const gfx::Point& location_in_screen) { 607 void Shell::ShowContextMenu(const gfx::Point& location_in_screen) {
605 // No context menus if user have not logged in. 608 // No context menus if there is no session with an active user.
606 if (!delegate_->IsUserLoggedIn()) 609 if (!session_state_delegate_->HasActiveUser())
607 return; 610 return;
608 // No context menus when screen is locked. 611 // No context menus when screen is locked.
609 if (IsScreenLocked()) 612 if (session_state_delegate_->IsScreenLocked())
610 return; 613 return;
611 614
612 aura::RootWindow* root = 615 aura::RootWindow* root =
613 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); 616 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()));
614 // TODO(oshima): The root and root window controller shouldn't be 617 // TODO(oshima): The root and root window controller shouldn't be
615 // NULL even for the out-of-bounds |location_in_screen| (It should 618 // NULL even for the out-of-bounds |location_in_screen| (It should
616 // return the primary root). Investigate why/how this is 619 // return the primary root). Investigate why/how this is
617 // happening. crbug.com/165214. 620 // happening. crbug.com/165214.
618 internal::RootWindowController* rwc = GetRootWindowController(root); 621 internal::RootWindowController* rwc = GetRootWindowController(root);
619 CHECK(rwc) << "root=" << root 622 CHECK(rwc) << "root=" << root
(...skipping 13 matching lines...) Expand all
633 636
634 bool Shell::GetAppListTargetVisibility() const { 637 bool Shell::GetAppListTargetVisibility() const {
635 return app_list_controller_.get() && 638 return app_list_controller_.get() &&
636 app_list_controller_->GetTargetVisibility(); 639 app_list_controller_->GetTargetVisibility();
637 } 640 }
638 641
639 aura::Window* Shell::GetAppListWindow() { 642 aura::Window* Shell::GetAppListWindow() {
640 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL; 643 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL;
641 } 644 }
642 645
643 bool Shell::CanLockScreen() {
644 return delegate_->CanLockScreen();
645 }
646
647 bool Shell::IsScreenLocked() const {
648 return delegate_->IsScreenLocked();
649 }
650
651 bool Shell::IsSystemModalWindowOpen() const { 646 bool Shell::IsSystemModalWindowOpen() const {
652 if (simulate_modal_window_open_for_testing_) 647 if (simulate_modal_window_open_for_testing_)
653 return true; 648 return true;
654 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( 649 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows(
655 internal::kShellWindowId_SystemModalContainer, NULL); 650 internal::kShellWindowId_SystemModalContainer, NULL);
656 for (std::vector<aura::Window*>::const_iterator cit = containers.begin(); 651 for (std::vector<aura::Window*>::const_iterator cit = containers.begin();
657 cit != containers.end(); ++cit) { 652 cit != containers.end(); ++cit) {
658 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin(); 653 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin();
659 wit != (*cit)->children().end(); ++wit) { 654 wit != (*cit)->children().end(); ++wit) {
660 if ((*wit)->GetProperty(aura::client::kModalKey) == 655 if ((*wit)->GetProperty(aura::client::kModalKey) ==
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 //////////////////////////////////////////////////////////////////////////////// 939 ////////////////////////////////////////////////////////////////////////////////
945 // Shell, aura::client::ActivationChangeObserver implementation: 940 // Shell, aura::client::ActivationChangeObserver implementation:
946 941
947 void Shell::OnWindowActivated(aura::Window* gained_active, 942 void Shell::OnWindowActivated(aura::Window* gained_active,
948 aura::Window* lost_active) { 943 aura::Window* lost_active) {
949 if (gained_active) 944 if (gained_active)
950 active_root_window_ = gained_active->GetRootWindow(); 945 active_root_window_ = gained_active->GetRootWindow();
951 } 946 }
952 947
953 } // namespace ash 948 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698