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

Side by Side Diff: ash/shell/context_menu.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/shell/app_list.cc ('k') | ash/shell/lock_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shell/context_menu.h" 5 #include "ash/shell/context_menu.h"
6 6
7 #include "ash/common/shelf/shelf_types.h" 7 #include "ash/common/shelf/shelf_types.h"
8 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "grit/ash_strings.h" 9 #include "grit/ash_strings.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace shell { 12 namespace shell {
13 13
14 ContextMenu::ContextMenu(WmShelf* wm_shelf) 14 ContextMenu::ContextMenu(WmShelf* wm_shelf)
15 : ui::SimpleMenuModel(nullptr), 15 : ui::SimpleMenuModel(nullptr),
16 wm_shelf_(wm_shelf), 16 wm_shelf_(wm_shelf),
17 alignment_menu_(wm_shelf) { 17 alignment_menu_(wm_shelf) {
18 DCHECK(wm_shelf_); 18 DCHECK(wm_shelf_);
19 set_delegate(this); 19 set_delegate(this);
20 AddCheckItemWithStringId(MENU_AUTO_HIDE, 20 AddCheckItemWithStringId(MENU_AUTO_HIDE,
21 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); 21 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
22 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, 22 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
23 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, 23 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_);
24 &alignment_menu_);
25 } 24 }
26 25
27 ContextMenu::~ContextMenu() { 26 ContextMenu::~ContextMenu() {}
28 }
29 27
30 bool ContextMenu::IsCommandIdChecked(int command_id) const { 28 bool ContextMenu::IsCommandIdChecked(int command_id) const {
31 if (command_id == MENU_AUTO_HIDE) 29 if (command_id == MENU_AUTO_HIDE)
32 return wm_shelf_->GetAutoHideBehavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; 30 return wm_shelf_->GetAutoHideBehavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
33 return false; 31 return false;
34 } 32 }
35 33
36 bool ContextMenu::IsCommandIdEnabled(int command_id) const { 34 bool ContextMenu::IsCommandIdEnabled(int command_id) const {
37 return true; 35 return true;
38 } 36 }
39 37
40 bool ContextMenu::GetAcceleratorForCommandId(int command_id, 38 bool ContextMenu::GetAcceleratorForCommandId(int command_id,
41 ui::Accelerator* accelerator) { 39 ui::Accelerator* accelerator) {
42 return false; 40 return false;
43 } 41 }
44 42
45 void ContextMenu::ExecuteCommand(int command_id, int event_flags) { 43 void ContextMenu::ExecuteCommand(int command_id, int event_flags) {
46 if (command_id == MENU_AUTO_HIDE) { 44 if (command_id == MENU_AUTO_HIDE) {
47 wm_shelf_->SetAutoHideBehavior(wm_shelf_->GetAutoHideBehavior() == 45 wm_shelf_->SetAutoHideBehavior(wm_shelf_->GetAutoHideBehavior() ==
48 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS 46 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
49 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER 47 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
50 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 48 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
51 } 49 }
52 } 50 }
53 51
54 } // namespace shell 52 } // namespace shell
55 } // namespace ash 53 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/app_list.cc ('k') | ash/shell/lock_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698