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 27 matching lines...) Expand all Loading... |
38 case SHELF_ALIGNMENT_RIGHT: | 38 case SHELF_ALIGNMENT_RIGHT: |
39 return command_id == MENU_ALIGN_RIGHT; | 39 return command_id == MENU_ALIGN_RIGHT; |
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( | |
49 int command_id, | |
50 ui::Accelerator* accelerator) const { | |
51 return false; | |
52 } | |
53 | |
54 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { | 48 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { |
55 WmShell* shell = WmShell::Get(); | 49 WmShell* shell = WmShell::Get(); |
56 switch (static_cast<MenuItem>(command_id)) { | 50 switch (static_cast<MenuItem>(command_id)) { |
57 case MENU_ALIGN_LEFT: | 51 case MENU_ALIGN_LEFT: |
58 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); | 52 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); |
59 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); | 53 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); |
60 break; | 54 break; |
61 case MENU_ALIGN_BOTTOM: | 55 case MENU_ALIGN_BOTTOM: |
62 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); | 56 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); |
63 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 57 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
64 break; | 58 break; |
65 case MENU_ALIGN_RIGHT: | 59 case MENU_ALIGN_RIGHT: |
66 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); | 60 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); |
67 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 61 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
68 break; | 62 break; |
69 } | 63 } |
70 } | 64 } |
71 | 65 |
72 } // namespace ash | 66 } // namespace ash |
OLD | NEW |