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