| OLD | NEW |
| 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/launcher/launcher_alignment_menu.h" | 5 #include "ash/launcher/launcher_alignment_menu.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
| 8 #include "ash/shelf/shelf_types.h" | 8 #include "ash/shelf/shelf_types.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "grit/ash_strings.h" | 10 #include "grit/ash_strings.h" |
| 11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 LauncherAlignmentMenu::LauncherAlignmentMenu( | 16 LauncherAlignmentMenu::LauncherAlignmentMenu(aura::RootWindow* root) |
| 17 aura::RootWindow* root) | |
| 18 : ui::SimpleMenuModel(NULL), | 17 : ui::SimpleMenuModel(NULL), |
| 19 root_window_(root) { | 18 root_window_(root) { |
| 20 DCHECK(root_window_); | 19 DCHECK(root_window_); |
| 21 int align_group_id = 1; | 20 int align_group_id = 1; |
| 22 set_delegate(this); | 21 set_delegate(this); |
| 23 AddRadioItemWithStringId(MENU_ALIGN_LEFT, | 22 AddRadioItemWithStringId(MENU_ALIGN_LEFT, |
| 24 IDS_AURA_LAUNCHER_CONTEXT_MENU_ALIGN_LEFT, | 23 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, |
| 25 align_group_id); | 24 align_group_id); |
| 26 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM, | 25 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM, |
| 27 IDS_AURA_LAUNCHER_CONTEXT_MENU_ALIGN_BOTTOM, | 26 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_BOTTOM, |
| 28 align_group_id); | 27 align_group_id); |
| 29 AddRadioItemWithStringId(MENU_ALIGN_RIGHT, | 28 AddRadioItemWithStringId(MENU_ALIGN_RIGHT, |
| 30 IDS_AURA_LAUNCHER_CONTEXT_MENU_ALIGN_RIGHT, | 29 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_RIGHT, |
| 31 align_group_id); | 30 align_group_id); |
| 32 } | 31 } |
| 33 | 32 |
| 34 LauncherAlignmentMenu::~LauncherAlignmentMenu() { | 33 LauncherAlignmentMenu::~LauncherAlignmentMenu() {} |
| 35 } | |
| 36 | 34 |
| 37 bool LauncherAlignmentMenu::IsCommandIdChecked(int command_id) const { | 35 bool LauncherAlignmentMenu::IsCommandIdChecked(int command_id) const { |
| 38 return internal::ShelfLayoutManager::ForLauncher(root_window_)-> | 36 return internal::ShelfLayoutManager::ForLauncher(root_window_)-> |
| 39 SelectValueForShelfAlignment( | 37 SelectValueForShelfAlignment( |
| 40 MENU_ALIGN_BOTTOM == command_id, | 38 MENU_ALIGN_BOTTOM == command_id, |
| 41 MENU_ALIGN_LEFT == command_id, | 39 MENU_ALIGN_LEFT == command_id, |
| 42 MENU_ALIGN_RIGHT == command_id, | 40 MENU_ALIGN_RIGHT == command_id, |
| 43 false); | 41 false); |
| 44 } | 42 } |
| 45 | 43 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 root_window_); | 62 root_window_); |
| 65 break; | 63 break; |
| 66 case MENU_ALIGN_RIGHT: | 64 case MENU_ALIGN_RIGHT: |
| 67 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, | 65 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, |
| 68 root_window_); | 66 root_window_); |
| 69 break; | 67 break; |
| 70 } | 68 } |
| 71 } | 69 } |
| 72 | 70 |
| 73 } // namespace ash | 71 } // namespace ash |
| OLD | NEW |