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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu.cc

Issue 2619083002: Clean up SessionStateDelegate in chrome (Closed)
Patch Set: fix LauncherContextMenuTest 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
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/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
11 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/strings/grit/ash_strings.h" 11 #include "ash/common/strings/grit/ash_strings.h"
13 #include "ash/common/wallpaper/wallpaper_delegate.h" 12 #include "ash/common/wallpaper/wallpaper_delegate.h"
14 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
15 #include "ash/common/wm_window.h" 14 #include "ash/common/wm_window.h"
16 #include "build/build_config.h" 15 #include "build/build_config.h"
17 #include "chrome/browser/fullscreen.h" 16 #include "chrome/browser/fullscreen.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
20 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 19 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
21 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" 20 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h"
22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
23 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
24 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" 23 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h"
25 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" 24 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h"
26 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
27 #include "chrome/grit/generated_resources.h" 26 #include "chrome/grit/generated_resources.h"
28 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
28 #include "components/session_manager/core/session_manager.h"
29 #include "content/public/common/context_menu_params.h" 29 #include "content/public/common/context_menu_params.h"
30 30
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 32 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
33 #endif // defined(OS_CHROMEOS) 33 #endif // defined(OS_CHROMEOS)
34 34
35 namespace { 35 namespace {
36 36
37 // Returns true if the user can modify the |shelf|'s auto-hide behavior. 37 // Returns true if the user can modify the |shelf|'s auto-hide behavior.
38 bool CanUserModifyShelfAutoHideBehavior(const Profile* profile) { 38 bool CanUserModifyShelfAutoHideBehavior(const Profile* profile) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // on the type of fullscreen. Do not show the auto-hide menu item while in 183 // on the type of fullscreen. Do not show the auto-hide menu item while in
184 // fullscreen per display because it is confusing when the preference appears 184 // fullscreen per display because it is confusing when the preference appears
185 // not to apply. 185 // not to apply.
186 int64_t display_id = wm_shelf_->GetWindow()->GetDisplayNearestWindow().id(); 186 int64_t display_id = wm_shelf_->GetWindow()->GetDisplayNearestWindow().id();
187 if (!IsFullScreenMode(display_id) && 187 if (!IsFullScreenMode(display_id) &&
188 CanUserModifyShelfAutoHideBehavior(controller_->profile())) { 188 CanUserModifyShelfAutoHideBehavior(controller_->profile())) {
189 AddCheckItemWithStringId(MENU_AUTO_HIDE, 189 AddCheckItemWithStringId(MENU_AUTO_HIDE,
190 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); 190 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
191 } 191 }
192 if (ash::WmShelf::CanChangeShelfAlignment() && 192 if (ash::WmShelf::CanChangeShelfAlignment() &&
193 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked()) { 193 !session_manager::SessionManager::Get()->IsScreenLocked()) {
194 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, 194 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
195 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, 195 IDS_ASH_SHELF_CONTEXT_MENU_POSITION,
196 &shelf_alignment_menu_); 196 &shelf_alignment_menu_);
197 } 197 }
198 if (!controller_->profile()->IsGuestSession()) 198 if (!controller_->profile()->IsGuestSession())
199 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); 199 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER);
200 } 200 }
201 201
202 bool LauncherContextMenu::ExecuteCommonCommand(int command_id, 202 bool LauncherContextMenu::ExecuteCommonCommand(int command_id,
203 int event_flags) { 203 int event_flags) {
204 switch (command_id) { 204 switch (command_id) {
205 case MENU_OPEN_NEW: 205 case MENU_OPEN_NEW:
206 case MENU_CLOSE: 206 case MENU_CLOSE:
207 case MENU_PIN: 207 case MENU_PIN:
208 case MENU_AUTO_HIDE: 208 case MENU_AUTO_HIDE:
209 case MENU_ALIGNMENT_MENU: 209 case MENU_ALIGNMENT_MENU:
210 case MENU_CHANGE_WALLPAPER: 210 case MENU_CHANGE_WALLPAPER:
211 LauncherContextMenu::ExecuteCommand(command_id, event_flags); 211 LauncherContextMenu::ExecuteCommand(command_id, event_flags);
212 return true; 212 return true;
213 default: 213 default:
214 return false; 214 return false;
215 } 215 }
216 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698