forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaccelerator_commands_aura.cc
54 lines (44 loc) · 1.74 KB
/
accelerator_commands_aura.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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_aura.h"
#include "ash/shell.h"
#include "ash/wm/screen_pinning_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
#include "base/metrics/user_metrics.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/manager/managed_display_info.h"
namespace ash {
namespace accelerators {
void ToggleTouchHudProjection() {
base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear"));
bool enabled = Shell::Get()->is_touch_hud_projection_enabled();
Shell::Get()->SetTouchHudProjectionEnabled(!enabled);
}
bool IsInternalDisplayZoomEnabled() {
display::DisplayManager* display_manager = Shell::Get()->display_manager();
return display_manager->IsDisplayUIScalingEnabled() ||
display_manager->IsInUnifiedMode();
}
bool ZoomInternalDisplay(bool up) {
if (up)
base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up"));
else
base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down"));
display::DisplayManager* display_manager = Shell::Get()->display_manager();
return display_manager->ZoomInternalDisplay(up);
}
void ResetInternalDisplayZoom() {
base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset"));
display::DisplayManager* display_manager = Shell::Get()->display_manager();
display_manager->ResetInternalDisplayZoom();
}
void Unpin() {
WmWindow* pinned_window =
Shell::Get()->screen_pinning_controller()->pinned_window();
if (pinned_window)
pinned_window->GetWindowState()->Restore();
}
} // namespace accelerators
} // namespace ash