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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "ash/system/chromeos/keyboard_brightness_controller.h" 74 #include "ash/system/chromeos/keyboard_brightness_controller.h"
75 #include "base/sys_info.h" 75 #include "base/sys_info.h"
76 #include "chromeos/ime/input_method_manager.h" 76 #include "chromeos/ime/input_method_manager.h"
77 #include "chromeos/ime/xkeyboard.h" 77 #include "chromeos/ime/xkeyboard.h"
78 #endif // defined(OS_CHROMEOS) 78 #endif // defined(OS_CHROMEOS)
79 79
80 namespace ash { 80 namespace ash {
81 namespace { 81 namespace {
82 82
83 using base::UserMetricsAction; 83 using base::UserMetricsAction;
84 using internal::DisplayInfo;
85 84
86 bool DebugShortcutsEnabled() { 85 bool DebugShortcutsEnabled() {
87 #if defined(NDEBUG) 86 #if defined(NDEBUG)
88 return CommandLine::ForCurrentProcess()->HasSwitch( 87 return CommandLine::ForCurrentProcess()->HasSwitch(
89 switches::kAshDebugShortcuts); 88 switches::kAshDebugShortcuts);
90 #else 89 #else
91 return true; 90 return true;
92 #endif 91 #endif
93 } 92 }
94 93
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 Shell::GetInstance()->new_window_delegate()->RestoreTab(); 284 Shell::GetInstance()->new_window_delegate()->RestoreTab();
286 return true; 285 return true;
287 } 286 }
288 287
289 bool HandleRotatePaneFocus(Shell::Direction direction) { 288 bool HandleRotatePaneFocus(Shell::Direction direction) {
290 Shell* shell = Shell::GetInstance(); 289 Shell* shell = Shell::GetInstance();
291 switch (direction) { 290 switch (direction) {
292 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE. 291 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE.
293 case Shell::FORWARD: { 292 case Shell::FORWARD: {
294 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane")); 293 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane"));
295 shell->focus_cycler()->RotateFocus(internal::FocusCycler::FORWARD); 294 shell->focus_cycler()->RotateFocus(FocusCycler::FORWARD);
296 break; 295 break;
297 } 296 }
298 case Shell::BACKWARD: { 297 case Shell::BACKWARD: {
299 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); 298 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane"));
300 shell->focus_cycler()->RotateFocus(internal::FocusCycler::BACKWARD); 299 shell->focus_cycler()->RotateFocus(FocusCycler::BACKWARD);
301 break; 300 break;
302 } 301 }
303 } 302 }
304 return true; 303 return true;
305 } 304 }
306 305
307 // Rotate the active window. 306 // Rotate the active window.
308 bool HandleRotateActiveWindow() { 307 bool HandleRotateActiveWindow() {
309 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); 308 base::RecordAction(UserMetricsAction("Accel_Rotate_Window"));
310 aura::Window* active_window = wm::GetActiveWindow(); 309 aura::Window* active_window = wm::GetActiveWindow();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); 342 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
344 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); 343 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
345 const DisplayInfo& display_info = 344 const DisplayInfo& display_info =
346 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); 345 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
347 Shell::GetInstance()->display_manager()->SetDisplayRotation( 346 Shell::GetInstance()->display_manager()->SetDisplayRotation(
348 display.id(), GetNextRotation(display_info.rotation())); 347 display.id(), GetNextRotation(display_info.rotation()));
349 return true; 348 return true;
350 } 349 }
351 350
352 bool HandleScaleReset() { 351 bool HandleScaleReset() {
353 internal::DisplayManager* display_manager = 352 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
354 Shell::GetInstance()->display_manager();
355 int64 display_id = display_manager->GetDisplayIdForUIScaling(); 353 int64 display_id = display_manager->GetDisplayIdForUIScaling();
356 if (display_id == gfx::Display::kInvalidDisplayID) 354 if (display_id == gfx::Display::kInvalidDisplayID)
357 return false; 355 return false;
358 356
359 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Reset")); 357 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Reset"));
360 358
361 display_manager->SetDisplayUIScale(display_id, 1.0f); 359 display_manager->SetDisplayUIScale(display_id, 1.0f);
362 return true; 360 return true;
363 } 361 }
364 362
365 bool HandleScaleUI(bool up) { 363 bool HandleScaleUI(bool up) {
366 internal::DisplayManager* display_manager = 364 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
367 Shell::GetInstance()->display_manager();
368 int64 display_id = display_manager->GetDisplayIdForUIScaling(); 365 int64 display_id = display_manager->GetDisplayIdForUIScaling();
369 if (display_id == gfx::Display::kInvalidDisplayID) 366 if (display_id == gfx::Display::kInvalidDisplayID)
370 return false; 367 return false;
371 368
372 if (up) { 369 if (up) {
373 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Up")); 370 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Up"));
374 } else { 371 } else {
375 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Down")); 372 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Down"));
376 } 373 }
377 374
378 const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id); 375 const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id);
379 float next_scale = 376 float next_scale = DisplayManager::GetNextUIScale(display_info, up);
380 internal::DisplayManager::GetNextUIScale(display_info, up);
381 display_manager->SetDisplayUIScale(display_id, next_scale); 377 display_manager->SetDisplayUIScale(display_id, next_scale);
382 return true; 378 return true;
383 } 379 }
384 380
385 bool HandleSwapPrimaryDisplay() { 381 bool HandleSwapPrimaryDisplay() {
386 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); 382 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display"));
387 Shell::GetInstance()->display_controller()->SwapPrimaryDisplay(); 383 Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
388 return true; 384 return true;
389 } 385 }
390 386
391 bool HandleShowKeyboardOverlay() { 387 bool HandleShowKeyboardOverlay() {
392 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); 388 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay"));
393 ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); 389 ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay();
394 390
395 return true; 391 return true;
396 } 392 }
397 393
398 void HandleShowMessageCenterBubble() { 394 void HandleShowMessageCenterBubble() {
399 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); 395 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble"));
400 internal::RootWindowController* controller = 396 RootWindowController* controller =
401 internal::RootWindowController::ForTargetRootWindow(); 397 RootWindowController::ForTargetRootWindow();
402 internal::StatusAreaWidget* status_area_widget = 398 StatusAreaWidget* status_area_widget =
403 controller->shelf()->status_area_widget(); 399 controller->shelf()->status_area_widget();
404 if (status_area_widget) { 400 if (status_area_widget) {
405 WebNotificationTray* notification_tray = 401 WebNotificationTray* notification_tray =
406 status_area_widget->web_notification_tray(); 402 status_area_widget->web_notification_tray();
407 if (notification_tray->visible()) 403 if (notification_tray->visible())
408 notification_tray->ShowMessageCenterBubble(); 404 notification_tray->ShowMessageCenterBubble();
409 } 405 }
410 } 406 }
411 407
412 bool HandleShowSystemTrayBubble() { 408 bool HandleShowSystemTrayBubble() {
413 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); 409 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble"));
414 internal::RootWindowController* controller = 410 RootWindowController* controller =
415 internal::RootWindowController::ForTargetRootWindow(); 411 RootWindowController::ForTargetRootWindow();
416 if (!controller->GetSystemTray()->HasSystemBubble()) { 412 if (!controller->GetSystemTray()->HasSystemBubble()) {
417 controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 413 controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
418 return true; 414 return true;
419 } 415 }
420 return false; 416 return false;
421 } 417 }
422 418
423 bool HandleShowTaskManager() { 419 bool HandleShowTaskManager() {
424 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager")); 420 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager"));
425 Shell::GetInstance()->new_window_delegate()->ShowTaskManager(); 421 Shell::GetInstance()->new_window_delegate()->ShowTaskManager();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 switches::kAshEnableTouchViewTesting)) { 593 switches::kAshEnableTouchViewTesting)) {
598 Shell* shell = Shell::GetInstance(); 594 Shell* shell = Shell::GetInstance();
599 shell->EnableMaximizeModeWindowManager( 595 shell->EnableMaximizeModeWindowManager(
600 !shell->IsMaximizeModeWindowManagerEnabled()); 596 !shell->IsMaximizeModeWindowManagerEnabled());
601 return true; 597 return true;
602 } 598 }
603 return false; 599 return false;
604 } 600 }
605 601
606 bool HandleTouchHudClear() { 602 bool HandleTouchHudClear() {
607 internal::RootWindowController* controller = 603 RootWindowController* controller =
608 internal::RootWindowController::ForTargetRootWindow(); 604 RootWindowController::ForTargetRootWindow();
609 if (controller->touch_hud_debug()) { 605 if (controller->touch_hud_debug()) {
610 controller->touch_hud_debug()->Clear(); 606 controller->touch_hud_debug()->Clear();
611 return true; 607 return true;
612 } 608 }
613 return false; 609 return false;
614 } 610 }
615 611
616 bool HandleTouchHudModeChange() { 612 bool HandleTouchHudModeChange() {
617 internal::RootWindowController* controller = 613 RootWindowController* controller =
618 internal::RootWindowController::ForTargetRootWindow(); 614 RootWindowController::ForTargetRootWindow();
619 if (controller->touch_hud_debug()) { 615 if (controller->touch_hud_debug()) {
620 controller->touch_hud_debug()->ChangeToNextMode(); 616 controller->touch_hud_debug()->ChangeToNextMode();
621 return true; 617 return true;
622 } 618 }
623 return false; 619 return false;
624 } 620 }
625 621
626 bool HandleTouchHudProjectToggle() { 622 bool HandleTouchHudProjectToggle() {
627 base::RecordAction(UserMetricsAction("Accel_Touch_Hud_Clear")); 623 base::RecordAction(UserMetricsAction("Accel_Touch_Hud_Clear"));
628 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); 624 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled();
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 keyboard_brightness_control_delegate) { 1179 keyboard_brightness_control_delegate) {
1184 keyboard_brightness_control_delegate_ = 1180 keyboard_brightness_control_delegate_ =
1185 keyboard_brightness_control_delegate.Pass(); 1181 keyboard_brightness_control_delegate.Pass();
1186 } 1182 }
1187 1183
1188 bool AcceleratorController::CanHandleAccelerators() const { 1184 bool AcceleratorController::CanHandleAccelerators() const {
1189 return true; 1185 return true;
1190 } 1186 }
1191 1187
1192 } // namespace ash 1188 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698