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/shell/context_menu.h" | 5 #include "ash/shell/context_menu.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/shelf_types.h" | 10 #include "ash/wm/shelf_types.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, | 26 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, |
27 &alignment_menu_); | 27 &alignment_menu_); |
28 } | 28 } |
29 | 29 |
30 ContextMenu::~ContextMenu() { | 30 ContextMenu::~ContextMenu() { |
31 } | 31 } |
32 | 32 |
33 bool ContextMenu::IsCommandIdChecked(int command_id) const { | 33 bool ContextMenu::IsCommandIdChecked(int command_id) const { |
34 switch (command_id) { | 34 switch (command_id) { |
35 case MENU_AUTO_HIDE: | 35 case MENU_AUTO_HIDE: |
36 return Shell::GetInstance()->IsShelfAutoHideMenuHideChecked(root_window_); | 36 return Shell::GetInstance()->GetShelfAutoHideBehavior(root_window_) == |
| 37 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
37 default: | 38 default: |
38 return false; | 39 return false; |
39 } | 40 } |
40 } | 41 } |
41 | 42 |
42 bool ContextMenu::IsCommandIdEnabled(int command_id) const { | 43 bool ContextMenu::IsCommandIdEnabled(int command_id) const { |
43 return true; | 44 return true; |
44 } | 45 } |
45 | 46 |
46 bool ContextMenu::GetAcceleratorForCommandId( | 47 bool ContextMenu::GetAcceleratorForCommandId( |
47 int command_id, | 48 int command_id, |
48 ui::Accelerator* accelerator) { | 49 ui::Accelerator* accelerator) { |
49 return false; | 50 return false; |
50 } | 51 } |
51 | 52 |
52 void ContextMenu::ExecuteCommand(int command_id) { | 53 void ContextMenu::ExecuteCommand(int command_id) { |
| 54 Shell* shell = Shell::GetInstance(); |
53 switch (static_cast<MenuItem>(command_id)) { | 55 switch (static_cast<MenuItem>(command_id)) { |
54 case MENU_AUTO_HIDE: | 56 case MENU_AUTO_HIDE: |
55 Shell::GetInstance()->SetShelfAutoHideBehavior( | 57 shell->SetShelfAutoHideBehavior( |
56 Shell::GetInstance()->GetToggledShelfAutoHideBehavior(root_window_), | 58 shell->GetShelfAutoHideBehavior(root_window_) == |
| 59 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
| 60 SHELF_AUTO_HIDE_BEHAVIOR_NEVER : |
| 61 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
57 root_window_); | 62 root_window_); |
58 break; | 63 break; |
59 case MENU_ALIGNMENT_MENU: | 64 case MENU_ALIGNMENT_MENU: |
60 break; | 65 break; |
61 } | 66 } |
62 } | 67 } |
63 | 68 |
64 } // namespace shell | 69 } // namespace shell |
65 } // namespace ash | 70 } // namespace ash |
OLD | NEW |