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 "ash/launcher/launcher_context_menu.h" | 7 #include "ash/launcher/launcher_context_menu.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "grit/ash_strings.h" | 13 #include "grit/ash_strings.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
17 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, | 17 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, |
18 const ash::LauncherItem* item) | 18 const ash::LauncherItem* item) |
19 : ui::SimpleMenuModel(NULL), | 19 : ui::SimpleMenuModel(NULL), |
20 controller_(controller), | 20 controller_(controller), |
21 item_(item ? *item : ash::LauncherItem()) { | 21 item_(item ? *item : ash::LauncherItem()) { |
22 set_delegate(this); | 22 set_delegate(this); |
23 | 23 |
24 if (is_valid_item()) { | 24 if (is_valid_item()) { |
25 if (item_.type == ash::TYPE_APP_SHORTCUT) { | 25 if (item_.type == ash::TYPE_APP_SHORTCUT) { |
26 DCHECK(controller->IsPinned(item_.id)); | 26 DCHECK(controller->IsPinned(item_.id)); |
27 AddItem( | 27 AddItem( |
28 MENU_PIN, | 28 MENU_PIN, |
29 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_UNPIN)); | 29 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_UNPIN)); |
30 // No open actions for pending app shortcut. | 30 AddSeparator(); |
31 if (item->status != ash::STATUS_IS_PENDING) { | 31 AddCheckItemWithStringId( |
32 AddSeparator(); | 32 LAUNCH_TYPE_REGULAR_TAB, |
33 AddCheckItemWithStringId( | 33 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); |
34 LAUNCH_TYPE_REGULAR_TAB, | 34 AddCheckItemWithStringId( |
35 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); | 35 LAUNCH_TYPE_PINNED_TAB, |
36 AddCheckItemWithStringId( | 36 IDS_APP_CONTEXT_MENU_OPEN_PINNED); |
37 LAUNCH_TYPE_PINNED_TAB, | 37 AddCheckItemWithStringId( |
38 IDS_APP_CONTEXT_MENU_OPEN_PINNED); | 38 LAUNCH_TYPE_WINDOW, |
39 AddCheckItemWithStringId( | 39 IDS_APP_CONTEXT_MENU_OPEN_WINDOW); |
40 LAUNCH_TYPE_WINDOW, | 40 // Even though the launch type is Full Screen it is more accurately |
41 IDS_APP_CONTEXT_MENU_OPEN_WINDOW); | 41 // described as Maximized in Ash. |
42 // Even though the launch type is Full Screen it is more accurately | 42 AddCheckItemWithStringId( |
43 // described as Maximized in Ash. | 43 LAUNCH_TYPE_FULLSCREEN, |
44 AddCheckItemWithStringId( | 44 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); |
45 LAUNCH_TYPE_FULLSCREEN, | |
46 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); | |
47 } | |
48 } else if (item_.type == ash::TYPE_BROWSER_SHORTCUT) { | 45 } else if (item_.type == ash::TYPE_BROWSER_SHORTCUT) { |
49 AddItem(MENU_NEW_WINDOW, | 46 AddItem(MENU_NEW_WINDOW, |
50 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_WINDOW)); | 47 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_WINDOW)); |
51 if (!controller_->IsLoggedInAsGuest()) { | 48 if (!controller_->IsLoggedInAsGuest()) { |
52 AddItem(MENU_NEW_INCOGNITO_WINDOW, | 49 AddItem(MENU_NEW_INCOGNITO_WINDOW, |
53 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_INCOGNITO_WINDOW)); | 50 l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_INCOGNITO_WINDOW)); |
54 } | 51 } |
55 } else { | 52 } else { |
56 AddItem(MENU_OPEN, controller->GetTitle(item_)); | 53 AddItem(MENU_OPEN, controller->GetTitle(item_)); |
57 if (item_.type == ash::TYPE_PLATFORM_APP) { | 54 if (item_.type == ash::TYPE_PLATFORM_APP) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 case MENU_NEW_WINDOW: | 147 case MENU_NEW_WINDOW: |
151 controller_->CreateNewWindow(); | 148 controller_->CreateNewWindow(); |
152 break; | 149 break; |
153 case MENU_NEW_INCOGNITO_WINDOW: | 150 case MENU_NEW_INCOGNITO_WINDOW: |
154 controller_->CreateNewIncognitoWindow(); | 151 controller_->CreateNewIncognitoWindow(); |
155 break; | 152 break; |
156 case MENU_ALIGNMENT_MENU: | 153 case MENU_ALIGNMENT_MENU: |
157 break; | 154 break; |
158 } | 155 } |
159 } | 156 } |
OLD | NEW |