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

Unified Diff: ash/accelerators/accelerator_commands.cc

Issue 23611005: ash: Allow web pages to use the Ctrl-M minimize shortcut (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: ash/accelerators/accelerator_commands.cc
diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc
new file mode 100644
index 0000000000000000000000000000000000000000..24b8a62b13e84fee0045b0a6860b80facde2ff8f
--- /dev/null
+++ b/ash/accelerators/accelerator_commands.cc
@@ -0,0 +1,36 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/accelerators/accelerator_commands.h"
+
+#include "ash/shell.h"
+#include "ash/shell_delegate.h"
+#include "ash/wm/window_cycle_controller.h"
+#include "ash/wm/window_util.h"
+
+namespace ash {
+namespace accelerators {
+
+bool ToggleMinimized() {
+ aura::Window* window = wm::GetActiveWindow();
+ // Attempt to restore the window that would be cycled through next from
+ // the launcher when there is no active window.
+ if (!window) {
+ ash::Shell::GetInstance()->window_cycle_controller()->
+ HandleCycleWindow(WindowCycleController::FORWARD, false);
+ return true;
+ }
+ // Disable the shortcut for minimizing full screen window due to
+ // crbug.com/131709, which is a crashing issue related to minimizing
+ // full screen pepper window.
+ if (wm::IsWindowFullscreen(window) || !wm::CanMinimizeWindow(window))
+ return false;
+ ash::Shell::GetInstance()->delegate()->RecordUserMetricsAction(
+ ash::UMA_MINIMIZE_PER_KEY);
+ wm::MinimizeWindow(window);
+ return true;
+}
+
+} // namespace accelerators
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698