OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/app_context_menu.h" | 5 #include "chrome/browser/ui/app_list/app_context_menu.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/extensions/context_menu_matcher.h" | 8 #include "chrome/browser/extensions/context_menu_matcher.h" |
9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/extensions/menu_manager.h" | 10 #include "chrome/browser/extensions/menu_manager.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 IDS_APP_LIST_CONTEXT_MENU_PIN); | 108 IDS_APP_LIST_CONTEXT_MENU_PIN); |
109 } | 109 } |
110 | 110 |
111 if (controller_->CanDoCreateShortcutsFlow()) { | 111 if (controller_->CanDoCreateShortcutsFlow()) { |
112 menu_model_->AddItemWithStringId(CREATE_SHORTCUTS, | 112 menu_model_->AddItemWithStringId(CREATE_SHORTCUTS, |
113 IDS_NEW_TAB_APP_CREATE_SHORTCUT); | 113 IDS_NEW_TAB_APP_CREATE_SHORTCUT); |
114 } | 114 } |
115 menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); | 115 menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); |
116 | 116 |
117 if (!is_platform_app_) { | 117 if (!is_platform_app_) { |
118 // Streamlined hosted apps can only toggle between USE_LAUNCH_TYPE_WINDOW | 118 // When bookmark apps are enabled, hosted apps can only toggle between |
119 // and USE_LAUNCH_TYPE_REGULAR. | 119 // USE_LAUNCH_TYPE_WINDOW and USE_LAUNCH_TYPE_REGULAR. |
120 if (extensions::util::IsStreamlinedHostedAppsEnabled()) { | 120 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
121 menu_model_->AddCheckItemWithStringId( | 121 menu_model_->AddCheckItemWithStringId( |
122 USE_LAUNCH_TYPE_REGULAR, | 122 USE_LAUNCH_TYPE_REGULAR, |
123 IDS_APP_CONTEXT_MENU_OPEN_TAB); | 123 IDS_APP_CONTEXT_MENU_OPEN_TAB); |
124 } else { | 124 } else { |
125 menu_model_->AddCheckItemWithStringId( | 125 menu_model_->AddCheckItemWithStringId( |
126 USE_LAUNCH_TYPE_REGULAR, | 126 USE_LAUNCH_TYPE_REGULAR, |
127 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); | 127 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); |
128 menu_model_->AddCheckItemWithStringId( | 128 menu_model_->AddCheckItemWithStringId( |
129 USE_LAUNCH_TYPE_PINNED, | 129 USE_LAUNCH_TYPE_PINNED, |
130 IDS_APP_CONTEXT_MENU_OPEN_PINNED); | 130 IDS_APP_CONTEXT_MENU_OPEN_PINNED); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return controller_->IsAppPinned(app_id_) ? | 187 return controller_->IsAppPinned(app_id_) ? |
188 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : | 188 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : |
189 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN); | 189 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN); |
190 } | 190 } |
191 | 191 |
192 DCHECK_EQ(LAUNCH_NEW, command_id); | 192 DCHECK_EQ(LAUNCH_NEW, command_id); |
193 | 193 |
194 // If --enable-new-bookmark-apps is enabled, then only check if | 194 // If --enable-new-bookmark-apps is enabled, then only check if |
195 // USE_LAUNCH_TYPE_REGULAR is checked, as USE_LAUNCH_TYPE_PINNED (i.e. open | 195 // USE_LAUNCH_TYPE_REGULAR is checked, as USE_LAUNCH_TYPE_PINNED (i.e. open |
196 // as pinned tab) and fullscreen-by-default windows do not exist. | 196 // as pinned tab) and fullscreen-by-default windows do not exist. |
197 if (extensions::util::IsStreamlinedHostedAppsEnabled()) { | 197 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
198 return IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR) ? | 198 return IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR) ? |
199 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) : | 199 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) : |
200 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW); | 200 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW); |
201 } | 201 } |
202 | 202 |
203 #if defined(OS_MACOSX) | 203 #if defined(OS_MACOSX) |
204 // Even fullscreen windows launch in a browser tab on Mac. | 204 // Even fullscreen windows launch in a browser tab on Mac. |
205 const bool launches_in_tab = true; | 205 const bool launches_in_tab = true; |
206 #else | 206 #else |
207 const bool launches_in_tab = IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) || | 207 const bool launches_in_tab = IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) || |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 else | 263 else |
264 controller_->PinApp(app_id_); | 264 controller_->PinApp(app_id_); |
265 } else if (command_id == CREATE_SHORTCUTS) { | 265 } else if (command_id == CREATE_SHORTCUTS) { |
266 controller_->DoCreateShortcutsFlow(profile_, app_id_); | 266 controller_->DoCreateShortcutsFlow(profile_, app_id_); |
267 } else if (command_id == SHOW_APP_INFO) { | 267 } else if (command_id == SHOW_APP_INFO) { |
268 controller_->DoShowAppInfoFlow(profile_, app_id_); | 268 controller_->DoShowAppInfoFlow(profile_, app_id_); |
269 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && | 269 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && |
270 command_id < USE_LAUNCH_TYPE_COMMAND_END) { | 270 command_id < USE_LAUNCH_TYPE_COMMAND_END) { |
271 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( | 271 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( |
272 command_id - USE_LAUNCH_TYPE_COMMAND_START); | 272 command_id - USE_LAUNCH_TYPE_COMMAND_START); |
273 // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and | 273 // When bookmark apps are enabled, hosted apps can only toggle between |
274 // LAUNCH_TYPE_REGULAR. | 274 // LAUNCH_TYPE_WINDOW and LAUNCH_TYPE_REGULAR. |
275 if (extensions::util::IsStreamlinedHostedAppsEnabled()) { | 275 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
276 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == | 276 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == |
277 extensions::LAUNCH_TYPE_REGULAR) ? | 277 extensions::LAUNCH_TYPE_REGULAR) ? |
278 extensions::LAUNCH_TYPE_WINDOW : | 278 extensions::LAUNCH_TYPE_WINDOW : |
279 extensions::LAUNCH_TYPE_REGULAR; | 279 extensions::LAUNCH_TYPE_REGULAR; |
280 } | 280 } |
281 controller_->SetExtensionLaunchType(profile_, app_id_, launch_type); | 281 controller_->SetExtensionLaunchType(profile_, app_id_, launch_type); |
282 } else if (command_id == OPTIONS) { | 282 } else if (command_id == OPTIONS) { |
283 controller_->ShowOptionsPage(profile_, app_id_); | 283 controller_->ShowOptionsPage(profile_, app_id_); |
284 } else if (command_id == UNINSTALL) { | 284 } else if (command_id == UNINSTALL) { |
285 controller_->UninstallApp(profile_, app_id_); | 285 controller_->UninstallApp(profile_, app_id_); |
286 } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( | 286 } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( |
287 command_id)) { | 287 command_id)) { |
288 extension_menu_items_->ExecuteCommand(command_id, NULL, | 288 extension_menu_items_->ExecuteCommand(command_id, NULL, |
289 content::ContextMenuParams()); | 289 content::ContextMenuParams()); |
290 } else if (command_id == MENU_NEW_WINDOW) { | 290 } else if (command_id == MENU_NEW_WINDOW) { |
291 controller_->CreateNewWindow(profile_, false); | 291 controller_->CreateNewWindow(profile_, false); |
292 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { | 292 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { |
293 controller_->CreateNewWindow(profile_, true); | 293 controller_->CreateNewWindow(profile_, true); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 } // namespace app_list | 297 } // namespace app_list |
OLD | NEW |