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

Side by Side Diff: ash/common/accelerators/accelerator_router.cc

Issue 2237433002: ash: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 | « no previous file | ash/common/wm/maximize_mode/maximize_mode_window_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/accelerators/accelerator_router.h" 5 #include "ash/common/accelerators/accelerator_router.h"
6 6
7 #include "ash/common/accelerators/accelerator_controller.h" 7 #include "ash/common/accelerators/accelerator_controller.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 WmWindow* target, 77 WmWindow* target,
78 const ui::KeyEvent& event, 78 const ui::KeyEvent& event,
79 const ui::Accelerator& accelerator) { 79 const ui::Accelerator& accelerator) {
80 // Callers should never supply null. 80 // Callers should never supply null.
81 DCHECK(target); 81 DCHECK(target);
82 // On ChromeOS, If the accelerator is Search+<key(s)> then it must never be 82 // On ChromeOS, If the accelerator is Search+<key(s)> then it must never be
83 // intercepted by apps or windows. 83 // intercepted by apps or windows.
84 if (accelerator.IsCmdDown()) 84 if (accelerator.IsCmdDown())
85 return true; 85 return true;
86 86
87 if (ContainsValue(WmShell::Get()->GetAllRootWindows(), target)) 87 if (base::ContainsValue(WmShell::Get()->GetAllRootWindows(), target))
88 return true; 88 return true;
89 89
90 AcceleratorController* accelerator_controller = 90 AcceleratorController* accelerator_controller =
91 WmShell::Get()->accelerator_controller(); 91 WmShell::Get()->accelerator_controller();
92 92
93 // Reserved accelerators (such as Power button) always have a prority. 93 // Reserved accelerators (such as Power button) always have a prority.
94 if (accelerator_controller->IsReserved(accelerator)) 94 if (accelerator_controller->IsReserved(accelerator))
95 return true; 95 return true;
96 96
97 // A full screen window has a right to handle all key events including the 97 // A full screen window has a right to handle all key events including the
98 // reserved ones. 98 // reserved ones.
99 WmWindow* top_level = target->GetToplevelWindowForFocus(); 99 WmWindow* top_level = target->GetToplevelWindowForFocus();
100 if (top_level && top_level->GetWindowState()->IsFullscreen()) { 100 if (top_level && top_level->GetWindowState()->IsFullscreen()) {
101 // On ChromeOS, fullscreen windows are either browser or apps, which 101 // On ChromeOS, fullscreen windows are either browser or apps, which
102 // send key events to a web content first, then will process keys 102 // send key events to a web content first, then will process keys
103 // if the web content didn't consume them. 103 // if the web content didn't consume them.
104 return false; 104 return false;
105 } 105 }
106 106
107 // Handle preferred accelerators (such as ALT-TAB) before sending 107 // Handle preferred accelerators (such as ALT-TAB) before sending
108 // to the target. 108 // to the target.
109 if (accelerator_controller->IsPreferred(accelerator)) 109 if (accelerator_controller->IsPreferred(accelerator))
110 return true; 110 return true;
111 111
112 return WmShell::Get()->GetAppListTargetVisibility(); 112 return WmShell::Get()->GetAppListTargetVisibility();
113 } 113 }
114 114
115 } // namespace ash 115 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/maximize_mode/maximize_mode_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698