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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/desktop_background/user_wallpaper_delegate.h" 9 #include "ash/desktop_background/user_wallpaper_delegate.h"
10 #include "ash/metrics/user_metrics_recorder.h" 10 #include "ash/metrics/user_metrics_recorder.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool LauncherContextMenu::IsItemForCommandIdDynamic(int command_id) const { 75 bool LauncherContextMenu::IsItemForCommandIdDynamic(int command_id) const {
76 return false; 76 return false;
77 } 77 }
78 78
79 base::string16 LauncherContextMenu::GetLabelForCommandId(int command_id) const { 79 base::string16 LauncherContextMenu::GetLabelForCommandId(int command_id) const {
80 NOTREACHED(); 80 NOTREACHED();
81 return base::string16(); 81 return base::string16();
82 } 82 }
83 83
84 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const { 84 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const {
85 if (command_id == MENU_AUTO_HIDE) { 85 if (command_id == MENU_AUTO_HIDE) {
msw 2016/05/27 22:36:41 nit: remove curlies
86 return shelf_->GetAutoHideBehavior() == 86 return shelf_->auto_hide_behavior() == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
87 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
88 } 87 }
89 DCHECK(command_id < MENU_ITEM_COUNT); 88 DCHECK(command_id < MENU_ITEM_COUNT);
90 return false; 89 return false;
91 } 90 }
92 91
93 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { 92 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const {
94 switch (command_id) { 93 switch (command_id) {
95 case MENU_PIN: 94 case MENU_PIN:
96 return controller_->IsPinnable(item_.id); 95 return controller_->IsPinnable(item_.id);
97 case MENU_CHANGE_WALLPAPER: 96 case MENU_CHANGE_WALLPAPER:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // TODO(simonhong): Use ShelfItemDelegate::Close(). 128 // TODO(simonhong): Use ShelfItemDelegate::Close().
130 controller_->Close(item_.id); 129 controller_->Close(item_.id);
131 } 130 }
132 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( 131 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
133 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); 132 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU);
134 break; 133 break;
135 case MENU_PIN: 134 case MENU_PIN:
136 controller_->TogglePinned(item_.id); 135 controller_->TogglePinned(item_.id);
137 break; 136 break;
138 case MENU_AUTO_HIDE: 137 case MENU_AUTO_HIDE:
139 shelf_->SetAutoHideBehavior(shelf_->GetAutoHideBehavior() == 138 shelf_->SetAutoHideBehavior(shelf_->auto_hide_behavior() ==
140 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS 139 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
141 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER 140 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER
142 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 141 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
143 break; 142 break;
144 case MENU_ALIGNMENT_MENU: 143 case MENU_ALIGNMENT_MENU:
145 break; 144 break;
146 case MENU_CHANGE_WALLPAPER: 145 case MENU_CHANGE_WALLPAPER:
147 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 146 ash::Shell::GetInstance()->user_wallpaper_delegate()->
148 OpenSetWallpaperPage(); 147 OpenSetWallpaperPage();
149 break; 148 break;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 case MENU_PIN: 202 case MENU_PIN:
204 case MENU_AUTO_HIDE: 203 case MENU_AUTO_HIDE:
205 case MENU_ALIGNMENT_MENU: 204 case MENU_ALIGNMENT_MENU:
206 case MENU_CHANGE_WALLPAPER: 205 case MENU_CHANGE_WALLPAPER:
207 LauncherContextMenu::ExecuteCommand(command_id, event_flags); 206 LauncherContextMenu::ExecuteCommand(command_id, event_flags);
208 return true; 207 return true;
209 default: 208 default:
210 return false; 209 return false;
211 } 210 }
212 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698