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 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 cursor_manager_.HideCursor(); | 614 cursor_manager_.HideCursor(); |
615 cursor_manager_.SetCursor(ui::kCursorPointer); | 615 cursor_manager_.SetCursor(ui::kCursorPointer); |
616 | 616 |
617 if (!cursor_manager_.IsCursorVisible()) { | 617 if (!cursor_manager_.IsCursorVisible()) { |
618 // Cursor might have been hidden by something other than chrome. | 618 // Cursor might have been hidden by something other than chrome. |
619 // Let the first mouse event show the cursor. | 619 // Let the first mouse event show the cursor. |
620 env_filter_->set_cursor_hidden_by_filter(true); | 620 env_filter_->set_cursor_hidden_by_filter(true); |
621 } | 621 } |
622 } | 622 } |
623 | 623 |
624 void Shell::ShowContextMenu(const gfx::Point& location_in_screen) { | 624 void Shell::ShowContextMenu(const gfx::Point& location_in_screen, |
| 625 ui::MenuSourceType source_type) { |
625 // No context menus if there is no session with an active user. | 626 // No context menus if there is no session with an active user. |
626 if (!session_state_delegate_->NumberOfLoggedInUsers()) | 627 if (!session_state_delegate_->NumberOfLoggedInUsers()) |
627 return; | 628 return; |
628 // No context menus when screen is locked. | 629 // No context menus when screen is locked. |
629 if (session_state_delegate_->IsScreenLocked()) | 630 if (session_state_delegate_->IsScreenLocked()) |
630 return; | 631 return; |
631 | 632 |
632 aura::RootWindow* root = | 633 aura::RootWindow* root = |
633 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); | 634 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); |
634 // TODO(oshima): The root and root window controller shouldn't be | 635 // TODO(oshima): The root and root window controller shouldn't be |
635 // NULL even for the out-of-bounds |location_in_screen| (It should | 636 // NULL even for the out-of-bounds |location_in_screen| (It should |
636 // return the primary root). Investigate why/how this is | 637 // return the primary root). Investigate why/how this is |
637 // happening. crbug.com/165214. | 638 // happening. crbug.com/165214. |
638 internal::RootWindowController* rwc = GetRootWindowController(root); | 639 internal::RootWindowController* rwc = GetRootWindowController(root); |
639 CHECK(rwc) << "root=" << root | 640 CHECK(rwc) << "root=" << root |
640 << ", location:" << location_in_screen.ToString(); | 641 << ", location:" << location_in_screen.ToString(); |
641 if (rwc) | 642 if (rwc) |
642 rwc->ShowContextMenu(location_in_screen); | 643 rwc->ShowContextMenu(location_in_screen, source_type); |
643 } | 644 } |
644 | 645 |
645 void Shell::ToggleAppList(aura::Window* window) { | 646 void Shell::ToggleAppList(aura::Window* window) { |
646 // If the context window is not given, show it on the active root window. | 647 // If the context window is not given, show it on the active root window. |
647 if (!window) | 648 if (!window) |
648 window = GetActiveRootWindow(); | 649 window = GetActiveRootWindow(); |
649 if (!app_list_controller_) | 650 if (!app_list_controller_) |
650 app_list_controller_.reset(new internal::AppListController); | 651 app_list_controller_.reset(new internal::AppListController); |
651 app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window); | 652 app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window); |
652 } | 653 } |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 //////////////////////////////////////////////////////////////////////////////// | 957 //////////////////////////////////////////////////////////////////////////////// |
957 // Shell, aura::client::ActivationChangeObserver implementation: | 958 // Shell, aura::client::ActivationChangeObserver implementation: |
958 | 959 |
959 void Shell::OnWindowActivated(aura::Window* gained_active, | 960 void Shell::OnWindowActivated(aura::Window* gained_active, |
960 aura::Window* lost_active) { | 961 aura::Window* lost_active) { |
961 if (gained_active) | 962 if (gained_active) |
962 active_root_window_ = gained_active->GetRootWindow(); | 963 active_root_window_ = gained_active->GetRootWindow(); |
963 } | 964 } |
964 | 965 |
965 } // namespace ash | 966 } // namespace ash |
OLD | NEW |