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

Side by Side Diff: athena/screen/screen_accelerator_handler.cc

Issue 863033002: Delete athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « athena/screen/screen_accelerator_handler.h ('k') | athena/screen/screen_manager_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "athena/screen/screen_accelerator_handler.h"
6
7 #include "athena/input/public/accelerator_manager.h"
8 #include "athena/screen/public/screen_manager.h"
9 #include "ui/events/event_constants.h"
10 #include "ui/gfx/display.h"
11 #include "ui/gfx/screen.h"
12
13 namespace athena {
14 namespace {
15
16 enum Command {
17 CMD_ROTATE_SCREEN,
18 };
19
20 const AcceleratorData accelerator_data[] = {
21 {TRIGGER_ON_PRESS, ui::VKEY_F3,
22 ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
23 CMD_ROTATE_SCREEN, AF_NONE},
24 };
25
26 void HandleRotateScreen() {
27 ScreenManager* screen_manager = ScreenManager::Get();
28 gfx::Display::Rotation current_rotation =
29 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().rotation();
30 if (current_rotation == gfx::Display::ROTATE_0)
31 screen_manager->SetRotation(gfx::Display::ROTATE_90);
32 else if (current_rotation == gfx::Display::ROTATE_90)
33 screen_manager->SetRotation(gfx::Display::ROTATE_180);
34 else if (current_rotation == gfx::Display::ROTATE_180)
35 screen_manager->SetRotation(gfx::Display::ROTATE_270);
36 else if (current_rotation == gfx::Display::ROTATE_270)
37 screen_manager->SetRotation(gfx::Display::ROTATE_0);
38 }
39
40 } // namespace
41
42 ScreenAcceleratorHandler::ScreenAcceleratorHandler() {
43 AcceleratorManager::Get()->RegisterAccelerators(
44 accelerator_data, arraysize(accelerator_data), this);
45 }
46
47 ScreenAcceleratorHandler::~ScreenAcceleratorHandler() {
48 }
49
50 bool ScreenAcceleratorHandler::IsCommandEnabled(int command_id) const {
51 return true;
52 }
53
54 bool ScreenAcceleratorHandler::OnAcceleratorFired(
55 int command_id,
56 const ui::Accelerator& accelerator) {
57 switch (command_id) {
58 case CMD_ROTATE_SCREEN:
59 HandleRotateScreen();
60 return true;
61 }
62 return false;
63 }
64
65 } // namesapce athena
OLDNEW
« no previous file with comments | « athena/screen/screen_accelerator_handler.h ('k') | athena/screen/screen_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698