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

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

Issue 2020623004: ash: Move shelf alignment and auto-hide calls from Shell to Shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo 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
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/desktop_background/user_wallpaper_delegate.h" 7 #include "ash/desktop_background/user_wallpaper_delegate.h"
8 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_types.h" 9 #include "ash/shelf/shelf_types.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 11 matching lines...) Expand all
22 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_); 22 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, &alignment_menu_);
23 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
24 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); 24 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER);
25 #endif 25 #endif
26 } 26 }
27 27
28 ContextMenuMus::~ContextMenuMus() {} 28 ContextMenuMus::~ContextMenuMus() {}
29 29
30 bool ContextMenuMus::IsCommandIdChecked(int command_id) const { 30 bool ContextMenuMus::IsCommandIdChecked(int command_id) const {
31 if (command_id == MENU_AUTO_HIDE) 31 if (command_id == MENU_AUTO_HIDE)
32 return shelf_->GetAutoHideBehavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; 32 return shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
33 return false; 33 return false;
34 } 34 }
35 35
36 bool ContextMenuMus::IsCommandIdEnabled(int command_id) const { 36 bool ContextMenuMus::IsCommandIdEnabled(int command_id) const {
37 Shell* shell = Shell::GetInstance(); 37 Shell* shell = Shell::GetInstance();
38 if (command_id == MENU_CHANGE_WALLPAPER) 38 if (command_id == MENU_CHANGE_WALLPAPER)
39 return shell->user_wallpaper_delegate()->CanOpenSetWallpaperPage(); 39 return shell->user_wallpaper_delegate()->CanOpenSetWallpaperPage();
40 return true; 40 return true;
41 } 41 }
42 42
43 bool ContextMenuMus::GetAcceleratorForCommandId(int command_id, 43 bool ContextMenuMus::GetAcceleratorForCommandId(int command_id,
44 ui::Accelerator* accelerator) { 44 ui::Accelerator* accelerator) {
45 return false; 45 return false;
46 } 46 }
47 47
48 void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) { 48 void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) {
49 if (command_id == MENU_AUTO_HIDE) { 49 if (command_id == MENU_AUTO_HIDE) {
50 shelf_->SetAutoHideBehavior(shelf_->GetAutoHideBehavior() == 50 shelf_->SetAutoHideBehavior(shelf_->auto_hide_behavior() ==
51 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS 51 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
msw 2016/05/27 22:36:40 nit: git cl format? (not your CL's fault if wrong)
James Cook 2016/05/27 22:56:26 This is the output of git cl format. :-(
52 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER 52 ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
53 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 53 : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
54 } else if (command_id == MENU_CHANGE_WALLPAPER) { 54 } else if (command_id == MENU_CHANGE_WALLPAPER) {
55 Shell::GetInstance()->user_wallpaper_delegate()->OpenSetWallpaperPage(); 55 Shell::GetInstance()->user_wallpaper_delegate()->OpenSetWallpaperPage();
56 } 56 }
57 } 57 }
58 58
59 } // namespace ash 59 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698