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/views/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/views/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 "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
10 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" | 11 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" |
| 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "grit/ash_strings.h" |
11 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
12 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
13 | 16 |
14 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, | 17 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, |
15 const ash::LauncherItem* item) | 18 const ash::LauncherItem* item) |
16 : ui::SimpleMenuModel(NULL), | 19 : ui::SimpleMenuModel(NULL), |
17 controller_(controller), | 20 controller_(controller), |
18 item_(item ? *item : ash::LauncherItem()) { | 21 item_(item ? *item : ash::LauncherItem()) { |
19 set_delegate(this); | 22 set_delegate(this); |
20 | 23 |
(...skipping 29 matching lines...) Expand all Loading... |
50 AddItem(MENU_OPEN, controller->GetTitle(item_)); | 53 AddItem(MENU_OPEN, controller->GetTitle(item_)); |
51 if (controller->IsOpen(item_.id)) { | 54 if (controller->IsOpen(item_.id)) { |
52 AddItem(MENU_CLOSE, | 55 AddItem(MENU_CLOSE, |
53 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); | 56 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); |
54 } | 57 } |
55 } | 58 } |
56 AddSeparator(); | 59 AddSeparator(); |
57 } | 60 } |
58 AddCheckItemWithStringId( | 61 AddCheckItemWithStringId( |
59 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId()); | 62 MENU_AUTO_HIDE, ash::LauncherContextMenu::GetAutoHideResourceStringId()); |
| 63 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 64 switches::kShowLauncherAlignmentMenu)) { |
| 65 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, |
| 66 IDS_AURA_LAUNCHER_CONTEXT_MENU_POSITION, |
| 67 &alignment_menu_); |
| 68 } |
60 } | 69 } |
61 | 70 |
62 LauncherContextMenu::~LauncherContextMenu() { | 71 LauncherContextMenu::~LauncherContextMenu() { |
63 } | 72 } |
64 | 73 |
65 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const { | 74 bool LauncherContextMenu::IsCommandIdChecked(int command_id) const { |
66 switch (command_id) { | 75 switch (command_id) { |
67 case LAUNCH_TYPE_PINNED_TAB: | 76 case LAUNCH_TYPE_PINNED_TAB: |
68 return controller_->GetLaunchType(item_.id) == | 77 return controller_->GetLaunchType(item_.id) == |
69 ExtensionPrefs::LAUNCH_PINNED; | 78 ExtensionPrefs::LAUNCH_PINNED; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 case MENU_AUTO_HIDE: | 133 case MENU_AUTO_HIDE: |
125 controller_->SetAutoHideBehavior( | 134 controller_->SetAutoHideBehavior( |
126 ash::LauncherContextMenu::GetToggledAutoHideBehavior()); | 135 ash::LauncherContextMenu::GetToggledAutoHideBehavior()); |
127 break; | 136 break; |
128 case MENU_NEW_WINDOW: | 137 case MENU_NEW_WINDOW: |
129 controller_->CreateNewWindow(); | 138 controller_->CreateNewWindow(); |
130 break; | 139 break; |
131 case MENU_NEW_INCOGNITO_WINDOW: | 140 case MENU_NEW_INCOGNITO_WINDOW: |
132 controller_->CreateNewIncognitoWindow(); | 141 controller_->CreateNewIncognitoWindow(); |
133 break; | 142 break; |
| 143 case MENU_ALIGNMENT_MENU: |
| 144 break; |
134 } | 145 } |
135 } | 146 } |
OLD | NEW |