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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/extensions/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
11 #include "chrome/browser/extensions/launch_util.h" | |
11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" | 14 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" |
14 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
17 #include "chrome/common/extensions/manifest_url_handler.h" | 18 #include "chrome/common/extensions/manifest_url_handler.h" |
18 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == | 234 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == |
234 AppListControllerDelegate::PIN_EDITABLE) { | 235 AppListControllerDelegate::PIN_EDITABLE) { |
235 if (controller_->IsAppPinned(app_id_)) | 236 if (controller_->IsAppPinned(app_id_)) |
236 controller_->UnpinApp(app_id_); | 237 controller_->UnpinApp(app_id_); |
237 else | 238 else |
238 controller_->PinApp(app_id_); | 239 controller_->PinApp(app_id_); |
239 } else if (command_id == CREATE_SHORTCUTS) { | 240 } else if (command_id == CREATE_SHORTCUTS) { |
240 controller_->DoCreateShortcutsFlow(profile_, app_id_); | 241 controller_->DoCreateShortcutsFlow(profile_, app_id_); |
241 } else if (command_id >= LAUNCH_TYPE_START && | 242 } else if (command_id >= LAUNCH_TYPE_START && |
242 command_id < LAUNCH_TYPE_LAST) { | 243 command_id < LAUNCH_TYPE_LAST) { |
243 extensions::ExtensionPrefs::LaunchType launch_type = | 244 extensions::LaunchType launch_type = |
244 static_cast<extensions::ExtensionPrefs::LaunchType>( | 245 static_cast<extensions::LaunchType>(command_id - LAUNCH_TYPE_START); |
245 command_id - LAUNCH_TYPE_START); | |
246 // Streamlined hosted apps can only toggle between LAUNCH_WINDOW and | 246 // Streamlined hosted apps can only toggle between LAUNCH_WINDOW and |
247 // LAUNCH_REGULAR. | 247 // LAUNCH_REGULAR. |
248 if (CommandLine::ForCurrentProcess()->HasSwitch( | 248 if (CommandLine::ForCurrentProcess()->HasSwitch( |
249 switches::kEnableStreamlinedHostedApps)) { | 249 switches::kEnableStreamlinedHostedApps)) { |
250 launch_type = controller_->GetExtensionLaunchType(profile_, app_id_) == | 250 launch_type = controller_->GetExtensionLaunchType(profile_, app_id_) == |
251 extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR | 251 extensions::LAUNCH_TYPE_REGULAR |
Yoyo Zhou
2013/12/05 02:43:50
nit: this indent looks funny
Daniel Erat
2013/12/05 03:24:35
agreed; i'll clean this up (don't like the leading
| |
252 ? extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW | 252 ? extensions::LAUNCH_TYPE_WINDOW |
253 : extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR; | 253 : extensions::LAUNCH_TYPE_REGULAR; |
254 } | 254 } |
255 controller_->SetExtensionLaunchType(profile_, | 255 controller_->SetExtensionLaunchType(profile_, |
256 app_id_, | 256 app_id_, |
257 launch_type); | 257 launch_type); |
258 } else if (command_id == OPTIONS) { | 258 } else if (command_id == OPTIONS) { |
259 controller_->ShowOptionsPage(profile_, app_id_); | 259 controller_->ShowOptionsPage(profile_, app_id_); |
260 } else if (command_id == UNINSTALL) { | 260 } else if (command_id == UNINSTALL) { |
261 controller_->UninstallApp(profile_, app_id_); | 261 controller_->UninstallApp(profile_, app_id_); |
262 } else if (command_id == DETAILS) { | 262 } else if (command_id == DETAILS) { |
263 controller_->ShowAppInWebStore(profile_, app_id_, is_search_result_); | 263 controller_->ShowAppInWebStore(profile_, app_id_, is_search_result_); |
264 } else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && | 264 } else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && |
265 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { | 265 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { |
266 extension_menu_items_->ExecuteCommand(command_id, NULL, | 266 extension_menu_items_->ExecuteCommand(command_id, NULL, |
267 content::ContextMenuParams()); | 267 content::ContextMenuParams()); |
268 } else if (command_id == MENU_NEW_WINDOW) { | 268 } else if (command_id == MENU_NEW_WINDOW) { |
269 controller_->CreateNewWindow(profile_, false); | 269 controller_->CreateNewWindow(profile_, false); |
270 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { | 270 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { |
271 controller_->CreateNewWindow(profile_, true); | 271 controller_->CreateNewWindow(profile_, true); |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
275 } // namespace app_list | 275 } // namespace app_list |
OLD | NEW |