OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/extension_launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
6 | 6 |
7 #include "ash/shell.h" | |
8 #include "base/bind.h" | 7 #include "base/bind.h" |
9 #include "chrome/browser/extensions/context_menu_matcher.h" | 8 #include "chrome/browser/extensions/context_menu_matcher.h" |
10 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
11 #include "chrome/browser/extensions/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
12 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
17 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 AddCheckItemWithStringId(LAUNCH_TYPE_FULLSCREEN, | 75 AddCheckItemWithStringId(LAUNCH_TYPE_FULLSCREEN, |
77 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); | 76 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); |
78 } | 77 } |
79 } | 78 } |
80 } else if (item().type == ash::TYPE_BROWSER_SHORTCUT) { | 79 } else if (item().type == ash::TYPE_BROWSER_SHORTCUT) { |
81 AddItemWithStringId(MENU_NEW_WINDOW, IDS_APP_LIST_NEW_WINDOW); | 80 AddItemWithStringId(MENU_NEW_WINDOW, IDS_APP_LIST_NEW_WINDOW); |
82 if (!controller()->profile()->IsGuestSession()) { | 81 if (!controller()->profile()->IsGuestSession()) { |
83 AddItemWithStringId(MENU_NEW_INCOGNITO_WINDOW, | 82 AddItemWithStringId(MENU_NEW_INCOGNITO_WINDOW, |
84 IDS_APP_LIST_NEW_INCOGNITO_WINDOW); | 83 IDS_APP_LIST_NEW_INCOGNITO_WINDOW); |
85 } | 84 } |
86 if (!BrowserShortcutLauncherItemController(ash::Shell::Get()->shelf_model()) | 85 if (!BrowserShortcutLauncherItemController(controller()->shelf_model()) |
87 .IsListOfActiveBrowserEmpty()) { | 86 .IsListOfActiveBrowserEmpty()) { |
88 AddItem(MENU_CLOSE, | 87 AddItem(MENU_CLOSE, |
89 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); | 88 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); |
90 } | 89 } |
91 } else if (item().type == ash::TYPE_DIALOG) { | 90 } else if (item().type == ash::TYPE_DIALOG) { |
92 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); | 91 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); |
93 } else if (controller()->IsOpen(item().id)) { | 92 } else if (controller()->IsOpen(item().id)) { |
94 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); | 93 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); |
95 } | 94 } |
96 AddSeparator(ui::NORMAL_SEPARATOR); | 95 AddSeparator(ui::NORMAL_SEPARATOR); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return extensions::LAUNCH_TYPE_DEFAULT; | 219 return extensions::LAUNCH_TYPE_DEFAULT; |
221 | 220 |
222 return extensions::GetLaunchType( | 221 return extensions::GetLaunchType( |
223 extensions::ExtensionPrefs::Get(controller()->profile()), extension); | 222 extensions::ExtensionPrefs::Get(controller()->profile()), extension); |
224 } | 223 } |
225 | 224 |
226 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { | 225 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { |
227 extensions::SetLaunchType(controller()->profile(), | 226 extensions::SetLaunchType(controller()->profile(), |
228 item().app_launch_id.app_id(), type); | 227 item().app_launch_id.app_id(), type); |
229 } | 228 } |
OLD | NEW |