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