OLD | NEW |
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/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
13 #include "ash/strings/grit/ash_strings.h" | 13 #include "ash/strings/grit/ash_strings.h" |
14 #include "ash/wallpaper/wallpaper_delegate.h" | 14 #include "ash/wallpaper/wallpaper_delegate.h" |
15 #include "ash/wm_window.h" | |
16 #include "build/build_config.h" | 15 #include "build/build_config.h" |
17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 16 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
18 #include "chrome/browser/fullscreen.h" | 17 #include "chrome/browser/fullscreen.h" |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
21 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 20 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
22 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" | 21 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
23 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
24 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 23 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
25 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" | 24 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return; | 164 return; |
166 } | 165 } |
167 AddItemWithStringId(MENU_PIN, menu_pin_string_id); | 166 AddItemWithStringId(MENU_PIN, menu_pin_string_id); |
168 } | 167 } |
169 | 168 |
170 void LauncherContextMenu::AddShelfOptionsMenu() { | 169 void LauncherContextMenu::AddShelfOptionsMenu() { |
171 // In fullscreen, the launcher is either hidden or auto hidden depending | 170 // In fullscreen, the launcher is either hidden or auto hidden depending |
172 // on the type of fullscreen. Do not show the auto-hide menu item while in | 171 // on the type of fullscreen. Do not show the auto-hide menu item while in |
173 // fullscreen per display because it is confusing when the preference appears | 172 // fullscreen per display because it is confusing when the preference appears |
174 // not to apply. | 173 // not to apply. |
175 int64_t display_id = shelf_->GetWindow()->GetDisplayNearestWindow().id(); | 174 display::Display display = |
176 if (!IsFullScreenMode(display_id) && | 175 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 176 shelf_->GetWindow()->GetRootWindow()); |
| 177 if (!IsFullScreenMode(display.id()) && |
177 CanUserModifyShelfAutoHideBehavior(controller_->profile())) { | 178 CanUserModifyShelfAutoHideBehavior(controller_->profile())) { |
178 AddCheckItemWithStringId(MENU_AUTO_HIDE, | 179 AddCheckItemWithStringId(MENU_AUTO_HIDE, |
179 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); | 180 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); |
180 } | 181 } |
181 if (ash::Shelf::CanChangeShelfAlignment() && | 182 if (ash::Shelf::CanChangeShelfAlignment() && |
182 !session_manager::SessionManager::Get()->IsScreenLocked()) { | 183 !session_manager::SessionManager::Get()->IsScreenLocked()) { |
183 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, | 184 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, |
184 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, | 185 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, |
185 &shelf_alignment_menu_); | 186 &shelf_alignment_menu_); |
186 } | 187 } |
187 if (!controller_->profile()->IsGuestSession()) | 188 if (!controller_->profile()->IsGuestSession()) |
188 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); | 189 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); |
189 } | 190 } |
190 | 191 |
191 bool LauncherContextMenu::ExecuteCommonCommand(int command_id, | 192 bool LauncherContextMenu::ExecuteCommonCommand(int command_id, |
192 int event_flags) { | 193 int event_flags) { |
193 switch (command_id) { | 194 switch (command_id) { |
194 case MENU_OPEN_NEW: | 195 case MENU_OPEN_NEW: |
195 case MENU_CLOSE: | 196 case MENU_CLOSE: |
196 case MENU_PIN: | 197 case MENU_PIN: |
197 case MENU_AUTO_HIDE: | 198 case MENU_AUTO_HIDE: |
198 case MENU_ALIGNMENT_MENU: | 199 case MENU_ALIGNMENT_MENU: |
199 case MENU_CHANGE_WALLPAPER: | 200 case MENU_CHANGE_WALLPAPER: |
200 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 201 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
201 return true; | 202 return true; |
202 default: | 203 default: |
203 return false; | 204 return false; |
204 } | 205 } |
205 } | 206 } |
OLD | NEW |