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

Unified Diff: ash/accelerators/accelerator_delegate.cc

Issue 582143004: Introduce "Preferred" accelerators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed typo Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_delegate.cc
diff --git a/ash/accelerators/accelerator_delegate.cc b/ash/accelerators/accelerator_delegate.cc
index 9dbd41035a902ef5a8a748ed18de49ab59e19b9b..bcdc75e0774d051e870bd530dc61319582f2cab3 100644
--- a/ash/accelerators/accelerator_delegate.cc
+++ b/ash/accelerators/accelerator_delegate.cc
@@ -59,26 +59,28 @@ bool AcceleratorDelegate::ShouldProcessAcceleratorNow(
root_windows.end())
return true;
- // A full screen window should be able to handle all key events including the
- // reserved ones.
aura::Window* top_level = ::wm::GetToplevelWindow(target);
+ Shell* shell = Shell::GetInstance();
+
+ // Reserved accelerators (such as Power button) always have a prority.
+ if (shell->accelerator_controller()->IsReserved(accelerator))
+ return true;
+ // A full screen window has a right to handle all key events including the
+ // reserved ones.
if (top_level && wm::GetWindowState(top_level)->IsFullscreen()) {
- // TODO(yusukes): On Chrome OS, only browser and flash windows can be full
- // screen. Launching an app in "open full-screen" mode is not supported yet.
- // That makes the IsWindowFullscreen() check above almost meaningless
- // because a browser and flash window do handle Ash accelerators anyway
- // before they're passed to a page or flash content.
+ // On ChromeOS, fullscreen windows are either browser or apps, which
+ // send key events to a web content first, then will process keys
+ // if the web content didn't consume them.
return false;
}
- if (Shell::GetInstance()->GetAppListTargetVisibility())
+ // Handle preferred accelerators (such as ALT-TAB) before sending
+ // to the target.
+ if (shell->accelerator_controller()->IsPreferred(accelerator))
return true;
- // Unless |target| is in the full screen state, handle reserved accelerators
- // such as Alt+Tab now.
- return Shell::GetInstance()->accelerator_controller()->IsReservedAccelerator(
- accelerator);
+ return shell->GetAppListTargetVisibility();
}
} // namespace ash
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698