| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/shelf/shelf_alignment_menu.h" | 5 #include "ash/common/shelf/shelf_alignment_menu.h" |
| 6 | 6 |
| 7 #include "ash/common/metrics/user_metrics_action.h" | 7 #include "ash/common/metrics/user_metrics_action.h" |
| 8 #include "ash/common/shelf/shelf_types.h" | 8 #include "ash/common/shelf/shelf_types.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 return false; | 41 return false; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool ShelfAlignmentMenu::IsCommandIdEnabled(int command_id) const { | 44 bool ShelfAlignmentMenu::IsCommandIdEnabled(int command_id) const { |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( | 48 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( |
| 49 int command_id, | 49 int command_id, |
| 50 ui::Accelerator* accelerator) { | 50 ui::Accelerator* accelerator) const { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { | 54 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { |
| 55 WmShell* shell = WmShell::Get(); | 55 WmShell* shell = WmShell::Get(); |
| 56 switch (static_cast<MenuItem>(command_id)) { | 56 switch (static_cast<MenuItem>(command_id)) { |
| 57 case MENU_ALIGN_LEFT: | 57 case MENU_ALIGN_LEFT: |
| 58 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); | 58 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); |
| 59 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); | 59 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 60 break; | 60 break; |
| 61 case MENU_ALIGN_BOTTOM: | 61 case MENU_ALIGN_BOTTOM: |
| 62 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); | 62 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); |
| 63 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 63 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 64 break; | 64 break; |
| 65 case MENU_ALIGN_RIGHT: | 65 case MENU_ALIGN_RIGHT: |
| 66 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); | 66 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); |
| 67 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 67 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace ash | 72 } // namespace ash |
| OLD | NEW |