| 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" |
| 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); |
| 20 AddRadioItemWithStringId(MENU_ALIGN_LEFT, | 20 AddRadioItemWithStringId( |
| 21 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, | 21 MENU_ALIGN_LEFT, IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, align_group_id); |
| 22 align_group_id); | |
| 23 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM, | 22 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM, |
| 24 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_BOTTOM, | 23 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_BOTTOM, |
| 25 align_group_id); | 24 align_group_id); |
| 26 AddRadioItemWithStringId(MENU_ALIGN_RIGHT, | 25 AddRadioItemWithStringId( |
| 27 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_RIGHT, | 26 MENU_ALIGN_RIGHT, IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_RIGHT, align_group_id); |
| 28 align_group_id); | |
| 29 } | 27 } |
| 30 | 28 |
| 31 ShelfAlignmentMenu::~ShelfAlignmentMenu() {} | 29 ShelfAlignmentMenu::~ShelfAlignmentMenu() {} |
| 32 | 30 |
| 33 bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const { | 31 bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const { |
| 34 switch (wm_shelf_->GetAlignment()) { | 32 switch (wm_shelf_->GetAlignment()) { |
| 35 case SHELF_ALIGNMENT_BOTTOM: | 33 case SHELF_ALIGNMENT_BOTTOM: |
| 36 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 34 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 37 return command_id == MENU_ALIGN_BOTTOM; | 35 return command_id == MENU_ALIGN_BOTTOM; |
| 38 case SHELF_ALIGNMENT_LEFT: | 36 case SHELF_ALIGNMENT_LEFT: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 65 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 63 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 66 break; | 64 break; |
| 67 case MENU_ALIGN_RIGHT: | 65 case MENU_ALIGN_RIGHT: |
| 68 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); | 66 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); |
| 69 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 67 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
| 70 break; | 68 break; |
| 71 } | 69 } |
| 72 } | 70 } |
| 73 | 71 |
| 74 } // namespace ash | 72 } // namespace ash |
| OLD | NEW |