| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/root_window_controller.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/property_util.h" |
| 11 #include "base/bind.h" | 13 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 13 #include "chrome/browser/extensions/context_menu_matcher.h" | 15 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 14 #include "chrome/browser/extensions/extension_prefs.h" | 16 #include "chrome/browser/extensions/extension_prefs.h" |
| 15 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 17 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 19 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 20 #include "content/public/common/context_menu_params.h" | 22 #include "content/public/common/context_menu_params.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 item_.type == ash::TYPE_PLATFORM_APP) { | 123 item_.type == ash::TYPE_PLATFORM_APP) { |
| 122 std::string app_id = controller_->GetAppIDForLauncherID(item_.id); | 124 std::string app_id = controller_->GetAppIDForLauncherID(item_.id); |
| 123 if (!app_id.empty()) { | 125 if (!app_id.empty()) { |
| 124 int index = 0; | 126 int index = 0; |
| 125 extension_items_->AppendExtensionItems( | 127 extension_items_->AppendExtensionItems( |
| 126 app_id, string16(), &index); | 128 app_id, string16(), &index); |
| 127 AddSeparatorIfNecessary(ui::NORMAL_SEPARATOR); | 129 AddSeparatorIfNecessary(ui::NORMAL_SEPARATOR); |
| 128 } | 130 } |
| 129 } | 131 } |
| 130 } | 132 } |
| 131 AddCheckItemWithStringId( | 133 // Don't show the auto-hide menu item while in immersive mode because the |
| 132 MENU_AUTO_HIDE, IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE); | 134 // launcher always auto-hides in this mode and it's confusing when the |
| 135 // preference appears not to apply. |
| 136 if (!ash::GetRootWindowController(root_window_)->IsImmersiveMode()) { |
| 137 AddCheckItemWithStringId( |
| 138 MENU_AUTO_HIDE, IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE); |
| 139 } |
| 133 if (CommandLine::ForCurrentProcess()->HasSwitch( | 140 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 134 switches::kShowLauncherAlignmentMenu)) { | 141 switches::kShowLauncherAlignmentMenu)) { |
| 135 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, | 142 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, |
| 136 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, | 143 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, |
| 137 &launcher_alignment_menu_); | 144 &launcher_alignment_menu_); |
| 138 } | 145 } |
| 139 AddItem(MENU_CHANGE_WALLPAPER, | 146 AddItem(MENU_CHANGE_WALLPAPER, |
| 140 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER)); | 147 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER)); |
| 141 } | 148 } |
| 142 | 149 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 break; | 263 break; |
| 257 case MENU_CHANGE_WALLPAPER: | 264 case MENU_CHANGE_WALLPAPER: |
| 258 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 265 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
| 259 OpenSetWallpaperPage(); | 266 OpenSetWallpaperPage(); |
| 260 break; | 267 break; |
| 261 default: | 268 default: |
| 262 extension_items_->ExecuteCommand(command_id, NULL, | 269 extension_items_->ExecuteCommand(command_id, NULL, |
| 263 content::ContextMenuParams()); | 270 content::ContextMenuParams()); |
| 264 } | 271 } |
| 265 } | 272 } |
| OLD | NEW |