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

Side by Side Diff: ash/sysui/context_menu_mus.cc

Issue 2271373002: mash: Port mojo:ash_sysui's ContextMenuMus to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 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
« no previous file with comments | « ash/sysui/context_menu_mus.h ('k') | ash/sysui/shell_delegate_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/sysui/context_menu_mus.h"
6
7 #include "ash/common/shelf/shelf_types.h"
8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/desktop_background/user_wallpaper_delegate.h"
10 #include "ash/shell.h"
11 #include "grit/ash_strings.h"
12
13 namespace ash {
14
15 ContextMenuMus::ContextMenuMus(WmShelf* wm_shelf)
16 : ui::SimpleMenuModel(nullptr),
17 wm_shelf_(wm_shelf),
18 alignment_menu_(wm_shelf) {
19 set_delegate(this);
20 AddCheckItemWithStringId(MENU_AUTO_HIDE,
21 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
22 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
23 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_);
24 #if defined(OS_CHROMEOS)
25 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER);
26 #endif
27 }
28
29 ContextMenuMus::~ContextMenuMus() {}
30
31 bool ContextMenuMus::IsCommandIdChecked(int command_id) const {
32 if (command_id == MENU_AUTO_HIDE)
33 return wm_shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
34 return false;
35 }
36
37 bool ContextMenuMus::IsCommandIdEnabled(int command_id) const {
38 Shell* shell = Shell::GetInstance();
39 if (command_id == MENU_CHANGE_WALLPAPER)
40 return shell->user_wallpaper_delegate()->CanOpenSetWallpaperPage();
41 return true;
42 }
43
44 void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) {
45 if (command_id == MENU_AUTO_HIDE) {
46 wm_shelf_->SetAutoHideBehavior(wm_shelf_->auto_hide_behavior() ==
47 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
48 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
49 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
50 } else if (command_id == MENU_CHANGE_WALLPAPER) {
51 Shell::GetInstance()->user_wallpaper_delegate()->OpenSetWallpaperPage();
52 }
53 }
54
55 } // namespace ash
OLDNEW
« no previous file with comments | « ash/sysui/context_menu_mus.h ('k') | ash/sysui/shell_delegate_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698