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

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

Issue 10823439: Ash: Support "Next Song", "Previous Song", "Play/Pause" Multi Media buttons (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed nits Created 8 years, 4 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
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 <string> 9 #include <string>
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5); 234 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5);
235 235
236 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); 236 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index));
237 237
238 ash::Shell::GetInstance()->magnification_controller()-> 238 ash::Shell::GetInstance()->magnification_controller()->
239 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); 239 SetScale(std::pow(kMagnificationFactor, new_scale_index), true);
240 240
241 return true; 241 return true;
242 } 242 }
243 243
244 bool HandleMediaNextTrack() {
245 Shell::GetInstance()->delegate()->HandleMediaNextTrack();
246 return true;
247 }
248
249 bool HandleMediaPlayPause() {
250 Shell::GetInstance()->delegate()->HandleMediaPlayPause();
251 return true;
252 }
253
254 bool HandleMediaPrevTrack() {
255 Shell::GetInstance()->delegate()->HandleMediaPrevTrack();
256 return true;
257 }
258
244 #if !defined(NDEBUG) 259 #if !defined(NDEBUG)
245 bool HandlePrintLayerHierarchy() { 260 bool HandlePrintLayerHierarchy() {
246 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 261 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
247 for (size_t i = 0; i < root_windows.size(); ++i) { 262 for (size_t i = 0; i < root_windows.size(); ++i) {
248 ui::PrintLayerHierarchy(root_windows[i]->layer(), 263 ui::PrintLayerHierarchy(root_windows[i]->layer(),
249 root_windows[i]->GetLastMouseLocationInRoot()); 264 root_windows[i]->GetLastMouseLocationInRoot());
250 } 265 }
251 return true; 266 return true;
252 } 267 }
253 268
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 case DISPLAY_CYCLE: 666 case DISPLAY_CYCLE:
652 internal::MultiDisplayManager::CycleDisplay(); 667 internal::MultiDisplayManager::CycleDisplay();
653 return true; 668 return true;
654 case DISPLAY_TOGGLE_SCALE: 669 case DISPLAY_TOGGLE_SCALE:
655 internal::MultiDisplayManager::ToggleDisplayScale(); 670 internal::MultiDisplayManager::ToggleDisplayScale();
656 return true; 671 return true;
657 case MAGNIFY_SCREEN_ZOOM_IN: 672 case MAGNIFY_SCREEN_ZOOM_IN:
658 return HandleMagnifyScreen(1); 673 return HandleMagnifyScreen(1);
659 case MAGNIFY_SCREEN_ZOOM_OUT: 674 case MAGNIFY_SCREEN_ZOOM_OUT:
660 return HandleMagnifyScreen(-1); 675 return HandleMagnifyScreen(-1);
676 case MEDIA_NEXT_TRACK:
677 return HandleMediaNextTrack();
678 case MEDIA_PLAY_PAUSE:
679 return HandleMediaPlayPause();
680 case MEDIA_PREV_TRACK:
681 return HandleMediaPrevTrack();
661 #if !defined(NDEBUG) 682 #if !defined(NDEBUG)
662 case PRINT_LAYER_HIERARCHY: 683 case PRINT_LAYER_HIERARCHY:
663 return HandlePrintLayerHierarchy(); 684 return HandlePrintLayerHierarchy();
664 case PRINT_VIEW_HIERARCHY: 685 case PRINT_VIEW_HIERARCHY:
665 return HandlePrintViewHierarchy(); 686 return HandlePrintViewHierarchy();
666 case PRINT_WINDOW_HIERARCHY: 687 case PRINT_WINDOW_HIERARCHY:
667 return HandlePrintWindowHierarchy(); 688 return HandlePrintWindowHierarchy();
668 #endif 689 #endif
669 default: 690 default:
670 NOTREACHED() << "Unhandled action " << action; 691 NOTREACHED() << "Unhandled action " << action;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 accelerators_.insert( 772 accelerators_.insert(
752 std::make_pair(accelerator, accelerators[i].action)); 773 std::make_pair(accelerator, accelerators[i].action));
753 } 774 }
754 } 775 }
755 776
756 bool AcceleratorController::CanHandleAccelerators() const { 777 bool AcceleratorController::CanHandleAccelerators() const {
757 return true; 778 return true;
758 } 779 }
759 780
760 } // namespace ash 781 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | chrome/browser/chromeos/extensions/media_player_event_router.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698