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

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

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 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/mus/bridge/wm_shell_mus.cc ('k') | ash/mus/shell_delegate_mus.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 2016 The Chromium Authors. All rights reserved. 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 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/mus/context_menu_mus.h" 5 #include "ash/mus/context_menu_mus.h"
6 6
7 #include "ash/common/shelf/wm_shelf.h" 7 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/common/wallpaper/wallpaper_controller.h" 8 #include "ash/common/wallpaper/wallpaper_controller.h"
9 #include "ash/common/wallpaper/wallpaper_delegate.h" 9 #include "ash/common/wallpaper/wallpaper_delegate.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
11 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
12 #include "grit/ash_strings.h" 12 #include "grit/ash_strings.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 ContextMenuMus::ContextMenuMus(WmShelf* wm_shelf) 16 ContextMenuMus::ContextMenuMus(WmShelf* wm_shelf)
17 : ui::SimpleMenuModel(nullptr), 17 : ui::SimpleMenuModel(nullptr),
18 wm_shelf_(wm_shelf), 18 wm_shelf_(wm_shelf),
19 alignment_menu_(wm_shelf) { 19 alignment_menu_(wm_shelf) {
20 set_delegate(this); 20 set_delegate(this);
21 AddCheckItemWithStringId(MENU_AUTO_HIDE, 21 AddCheckItemWithStringId(MENU_AUTO_HIDE,
22 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); 22 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
23 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, 23 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
24 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_); 24 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_);
25 #if defined(OS_CHROMEOS)
26 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); 25 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER);
27 #endif
28 } 26 }
29 27
30 ContextMenuMus::~ContextMenuMus() {} 28 ContextMenuMus::~ContextMenuMus() {}
31 29
32 bool ContextMenuMus::IsCommandIdChecked(int command_id) const { 30 bool ContextMenuMus::IsCommandIdChecked(int command_id) const {
33 if (command_id == MENU_AUTO_HIDE) 31 if (command_id == MENU_AUTO_HIDE)
34 return wm_shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; 32 return wm_shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
35 return false; 33 return false;
36 } 34 }
37 35
38 bool ContextMenuMus::IsCommandIdEnabled(int command_id) const { 36 bool ContextMenuMus::IsCommandIdEnabled(int command_id) const {
39 if (command_id == MENU_CHANGE_WALLPAPER) 37 if (command_id == MENU_CHANGE_WALLPAPER)
40 return WmShell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage(); 38 return WmShell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage();
41 return true; 39 return true;
42 } 40 }
43 41
44 void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) { 42 void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) {
45 if (command_id == MENU_AUTO_HIDE) { 43 if (command_id == MENU_AUTO_HIDE) {
46 wm_shelf_->SetAutoHideBehavior(wm_shelf_->auto_hide_behavior() == 44 wm_shelf_->SetAutoHideBehavior(wm_shelf_->auto_hide_behavior() ==
47 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS 45 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
48 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER 46 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
49 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 47 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
50 } else if (command_id == MENU_CHANGE_WALLPAPER) { 48 } else if (command_id == MENU_CHANGE_WALLPAPER) {
51 WmShell::Get()->wallpaper_controller()->OpenSetWallpaperPage(); 49 WmShell::Get()->wallpaper_controller()->OpenSetWallpaperPage();
52 } 50 }
53 } 51 }
54 52
55 } // namespace ash 53 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.cc ('k') | ash/mus/shell_delegate_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698