Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: ash/shelf/shelf_alignment_menu.cc

Issue 23983013: ash: Rename LauncherAlignmentMenu to ShelfAlignmentMenu and move to shelf/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix header include guard Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shelf/shelf_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(aura::RootWindow* root) 16 ShelfAlignmentMenu::ShelfAlignmentMenu(aura::RootWindow* root)
17 : ui::SimpleMenuModel(NULL), 17 : ui::SimpleMenuModel(NULL),
18 root_window_(root) { 18 root_window_(root) {
19 DCHECK(root_window_); 19 DCHECK(root_window_);
20 int align_group_id = 1; 20 int align_group_id = 1;
21 set_delegate(this); 21 set_delegate(this);
22 AddRadioItemWithStringId(MENU_ALIGN_LEFT, 22 AddRadioItemWithStringId(MENU_ALIGN_LEFT,
23 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, 23 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT,
24 align_group_id); 24 align_group_id);
25 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM, 25 AddRadioItemWithStringId(MENU_ALIGN_BOTTOM,
26 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_BOTTOM, 26 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_BOTTOM,
27 align_group_id); 27 align_group_id);
28 AddRadioItemWithStringId(MENU_ALIGN_RIGHT, 28 AddRadioItemWithStringId(MENU_ALIGN_RIGHT,
29 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_RIGHT, 29 IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_RIGHT,
30 align_group_id); 30 align_group_id);
31 } 31 }
32 32
33 LauncherAlignmentMenu::~LauncherAlignmentMenu() {} 33 ShelfAlignmentMenu::~ShelfAlignmentMenu() {}
34 34
35 bool LauncherAlignmentMenu::IsCommandIdChecked(int command_id) const { 35 bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const {
36 return internal::ShelfLayoutManager::ForLauncher(root_window_)-> 36 return internal::ShelfLayoutManager::ForLauncher(root_window_)->
37 SelectValueForShelfAlignment( 37 SelectValueForShelfAlignment(
38 MENU_ALIGN_BOTTOM == command_id, 38 MENU_ALIGN_BOTTOM == command_id,
39 MENU_ALIGN_LEFT == command_id, 39 MENU_ALIGN_LEFT == command_id,
40 MENU_ALIGN_RIGHT == command_id, 40 MENU_ALIGN_RIGHT == command_id,
41 false); 41 false);
42 } 42 }
43 43
44 bool LauncherAlignmentMenu::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 LauncherAlignmentMenu::GetAcceleratorForCommandId( 48 bool ShelfAlignmentMenu::GetAcceleratorForCommandId(
49 int command_id, 49 int command_id,
50 ui::Accelerator* accelerator) { 50 ui::Accelerator* accelerator) {
51 return false; 51 return false;
52 } 52 }
53 53
54 void LauncherAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { 54 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) {
55 switch (static_cast<MenuItem>(command_id)) { 55 switch (static_cast<MenuItem>(command_id)) {
56 case MENU_ALIGN_LEFT: 56 case MENU_ALIGN_LEFT:
57 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, 57 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT,
58 root_window_); 58 root_window_);
59 break; 59 break;
60 case MENU_ALIGN_BOTTOM: 60 case MENU_ALIGN_BOTTOM:
61 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM, 61 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM,
62 root_window_); 62 root_window_);
63 break; 63 break;
64 case MENU_ALIGN_RIGHT: 64 case MENU_ALIGN_RIGHT:
65 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, 65 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT,
66 root_window_); 66 root_window_);
67 break; 67 break;
68 } 68 }
69 } 69 }
70 70
71 } // namespace ash 71 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698