| 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/shelf/shelf_types.h" | 8 #include "ash/common/shelf/shelf_types.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm/wm_user_metrics_action.h" | |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "grit/ash_strings.h" | 11 #include "grit/ash_strings.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 ShelfAlignmentMenu::ShelfAlignmentMenu(WmShelf* wm_shelf) | 15 ShelfAlignmentMenu::ShelfAlignmentMenu(WmShelf* wm_shelf) |
| 16 : ui::SimpleMenuModel(nullptr), wm_shelf_(wm_shelf) { | 16 : ui::SimpleMenuModel(nullptr), wm_shelf_(wm_shelf) { |
| 17 DCHECK(wm_shelf_); | 17 DCHECK(wm_shelf_); |
| 18 const int align_group_id = 1; | 18 const int align_group_id = 1; |
| 19 set_delegate(this); | 19 set_delegate(this); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( | 50 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( |
| 51 int command_id, | 51 int command_id, |
| 52 ui::Accelerator* accelerator) { | 52 ui::Accelerator* accelerator) { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { | 56 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { |
| 57 WmShell* shell = WmShell::Get(); | 57 WmShell* shell = WmShell::Get(); |
| 58 switch (static_cast<MenuItem>(command_id)) { | 58 switch (static_cast<MenuItem>(command_id)) { |
| 59 case MENU_ALIGN_LEFT: | 59 case MENU_ALIGN_LEFT: |
| 60 shell->RecordUserMetricsAction( | 60 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); |
| 61 wm::WmUserMetricsAction::SHELF_ALIGNMENT_SET_LEFT); | |
| 62 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); | 61 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 63 break; | 62 break; |
| 64 case MENU_ALIGN_BOTTOM: | 63 case MENU_ALIGN_BOTTOM: |
| 65 shell->RecordUserMetricsAction( | 64 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); |
| 66 wm::WmUserMetricsAction::SHELF_ALIGNMENT_SET_BOTTOM); | |
| 67 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 65 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 68 break; | 66 break; |
| 69 case MENU_ALIGN_RIGHT: | 67 case MENU_ALIGN_RIGHT: |
| 70 shell->RecordUserMetricsAction( | 68 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); |
| 71 wm::WmUserMetricsAction::SHELF_ALIGNMENT_SET_RIGHT); | |
| 72 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 69 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
| 73 break; | 70 break; |
| 74 } | 71 } |
| 75 } | 72 } |
| 76 | 73 |
| 77 } // namespace ash | 74 } // namespace ash |
| OLD | NEW |