190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file. 490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/app_list/app_context_menu.h" 690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/app/chrome_command_ids.h" 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/extensions/context_menu_matcher.h" 990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/extensions/extension_service.h" 1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/extensions/extension_system.h" 1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/extensions/extension_uninstall_dialog.h" 1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/extensions/management_policy.h" 1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/prefs/incognito_mode_prefs.h" 1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/profiles/profile.h" 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/app_list/app_context_menu_delegate.h" 1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/browser_navigator.h" 1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/common/extensions/manifest_url_handler.h" 1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "content/public/common/context_menu_params.h" 2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "grit/chromium_strings.h" 2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "grit/generated_resources.h" 2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ui/base/l10n/l10n_util.h" 2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#if defined(USE_ASH) 2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ash/shell.h" 2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif 2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)using extensions::Extension; 2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace app_list { 3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace { 3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)enum CommandId { 3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_NEW = 100, 3690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) TOGGLE_PIN, 3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) CREATE_SHORTCUTS, 3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) OPTIONS, 3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) UNINSTALL, 4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) DETAILS, 4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) MENU_NEW_WINDOW, 4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) MENU_NEW_INCOGNITO_WINDOW, 4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Order matters in LAUNCHER_TYPE_xxxx and must match LaunchType. 4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_START = 200, 4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_PINNED_TAB = LAUNCH_TYPE_START, 4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_REGULAR_TAB, 4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_FULLSCREEN, 4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_WINDOW, 4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_LAST, 5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}; 5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 5290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// ExtensionUninstaller runs the extension uninstall flow. It shows the 5390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// extension uninstall dialog and wait for user to confirm or cancel the 5490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// uninstall. 5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class ExtensionUninstaller : public ExtensionUninstallDialog::Delegate { 5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public: 5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ExtensionUninstaller(Profile* profile, 5890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const std::string& extension_id, 5990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) AppListControllerDelegate* controller) 6090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) : profile_(profile), 6190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) app_id_(extension_id), 6290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_(controller) { 6390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 6490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 6590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) void Run() { 6690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = 6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile_)->extension_service()-> 6890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) GetExtensionById(app_id_, true); 6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!extension) { 7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) CleanUp(); 7190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return; 7290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 7390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->OnShowExtensionPrompt(); 7490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) dialog_.reset(ExtensionUninstallDialog::Create(profile_, NULL, this)); 7590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) dialog_->ConfirmUninstall(extension); 7690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 7790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 7890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private: 7990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Overridden from ExtensionUninstallDialog::Delegate: 8090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual void ExtensionUninstallAccepted() OVERRIDE { 8190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ExtensionService* service = 8290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile_)->extension_service(); 8390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = service->GetInstalledExtension(app_id_); 8490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (extension) { 8590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) service->UninstallExtension(app_id_, 8690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) false, /* external_uninstall*/ 8790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) NULL); 8890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 8990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->OnCloseExtensionPrompt(); 9090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) CleanUp(); 9190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 9290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 9390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual void ExtensionUninstallCanceled() OVERRIDE { 9490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->OnCloseExtensionPrompt(); 9590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) CleanUp(); 9690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 9790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 9890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) void CleanUp() { 9990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) delete this; 10090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 10190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 10290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) Profile* profile_; 10390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) std::string app_id_; 10490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) AppListControllerDelegate* controller_; 10590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) scoped_ptr<ExtensionUninstallDialog> dialog_; 10690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 10790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ExtensionUninstaller); 10890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}; 10990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 11090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)extensions::ExtensionPrefs::LaunchType GetExtensionLaunchType( 11190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) Profile* profile, 11290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension) { 11390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ExtensionService* service = 11490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile)->extension_service(); 11590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return service->extension_prefs()-> 11690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) GetLaunchType(extension, extensions::ExtensionPrefs::LAUNCH_DEFAULT); 11790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 11890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 11990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void SetExtensionLaunchType( 12090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) Profile* profile, 12190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const std::string& extension_id, 12290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionPrefs::LaunchType launch_type) { 12390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ExtensionService* service = 12490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile)->extension_service(); 12590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) service->extension_prefs()->SetLaunchType(extension_id, launch_type); 12690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 12790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 12890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { 12990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return item->contexts().Contains(extensions::MenuItem::LAUNCHER); 13090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 13190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 13290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} // namespace 13390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 13490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)AppContextMenu::AppContextMenu(AppContextMenuDelegate* delegate, 13590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) Profile* profile, 13690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const std::string& app_id, 13790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) AppListControllerDelegate* controller, 13890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) bool is_platform_app) 13990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) : delegate_(delegate), 14090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) profile_(profile), 14190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) app_id_(app_id), 14290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_(controller), 14390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) is_platform_app_(is_platform_app) { 14490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 14590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 14690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)AppContextMenu::~AppContextMenu() {} 14790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 14890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)ui::MenuModel* AppContextMenu::GetMenuModel() { 14990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 15090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!extension) 15190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return NULL; 15290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 15390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (menu_model_.get()) 15490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return menu_model_.get(); 15590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 15690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_.reset(new ui::SimpleMenuModel(this)); 15790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 15890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (app_id_ == extension_misc::kChromeAppId) { 15990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId( 16090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) MENU_NEW_WINDOW, 16190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_LIST_NEW_WINDOW); 16290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!profile_->IsOffTheRecord()) { 16390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId( 16490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) MENU_NEW_INCOGNITO_WINDOW, 16590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_LIST_NEW_INCOGNITO_WINDOW); 16690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 16790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else { 16890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extension_menu_items_.reset(new extensions::ContextMenuMatcher( 16990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) profile_, this, menu_model_.get(), 17090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) base::Bind(MenuItemHasLauncherContext))); 17190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 17290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!is_platform_app_) 17390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItem(LAUNCH_NEW, string16()); 17490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 17590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) int index = 0; 17690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extension_menu_items_->AppendExtensionItems(app_id_, string16(), 17790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) &index); 17890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 17990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (controller_->CanPin()) { 18090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); 18190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId( 18290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) TOGGLE_PIN, 18390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->IsAppPinned(app_id_) ? 18490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_LIST_CONTEXT_MENU_UNPIN : 18590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_LIST_CONTEXT_MENU_PIN); 18690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 18790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 188eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch if (controller_->CanDoCreateShortcutsFlow(is_platform_app_)) { 18990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId(CREATE_SHORTCUTS, 19090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_NEW_TAB_APP_CREATE_SHORTCUT); 19190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 19290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 19390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!is_platform_app_) { 19490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); 19590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddCheckItemWithStringId( 19690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_REGULAR_TAB, 19790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_CONTEXT_MENU_OPEN_REGULAR); 19890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddCheckItemWithStringId( 19990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_PINNED_TAB, 20090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_CONTEXT_MENU_OPEN_PINNED); 20190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#if defined(USE_ASH) 20290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!ash::Shell::IsForcedMaximizeMode()) 20390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif 20490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) { 205eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#if defined(OS_MACOSX) 206eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Mac does not support standalone web app browser windows or maximize. 207eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch menu_model_->AddCheckItemWithStringId( 208eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch LAUNCH_TYPE_FULLSCREEN, 209eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN); 210eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#else 21190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddCheckItemWithStringId( 21290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_WINDOW, 21390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_CONTEXT_MENU_OPEN_WINDOW); 21490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Even though the launch type is Full Screen it is more accurately 21590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // described as Maximized in Ash. 21690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddCheckItemWithStringId( 21790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_FULLSCREEN, 21890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); 219eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#endif 22090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 22190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); 22290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); 22390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 22490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 22590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId(DETAILS, IDS_NEW_TAB_APP_DETAILS); 22690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) menu_model_->AddItemWithStringId( 22790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) UNINSTALL, 22890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) is_platform_app_ ? IDS_APP_LIST_UNINSTALL_ITEM 22990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) : IDS_EXTENSIONS_UNINSTALL); 23090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 23190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 23290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return menu_model_.get(); 23390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 23490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 23590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const Extension* AppContextMenu::GetExtension() const { 23690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const ExtensionService* service = 23790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile_)->extension_service(); 23890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = service->GetInstalledExtension(app_id_); 23990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return extension; 24090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 24190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 24290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void AppContextMenu::ShowExtensionOptions() { 24390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 24490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!extension) 24590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return; 24690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 24790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) chrome::NavigateParams params( 24890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) profile_, 24990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ManifestURL::GetOptionsPage(extension), 25090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) content::PAGE_TRANSITION_LINK); 25190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) chrome::Navigate(¶ms); 25290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 25390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 25490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void AppContextMenu::ShowExtensionDetails() { 25590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 25690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!extension) 25790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return; 25890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 25990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) chrome::NavigateParams params( 26090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) profile_, 26190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ManifestURL::GetDetailsURL(extension), 26290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) content::PAGE_TRANSITION_LINK); 26390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) chrome::Navigate(¶ms); 26490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 26590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 26690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void AppContextMenu::StartExtensionUninstall() { 26790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // ExtensionUninstall deletes itself when done or aborted. 26890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_, 26990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) app_id_, 27090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_); 27190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) uninstaller->Run(); 27290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 27390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 27490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool AppContextMenu::IsItemForCommandIdDynamic(int command_id) const { 27590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return command_id == TOGGLE_PIN || command_id == LAUNCH_NEW; 27690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 27790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 27890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)string16 AppContextMenu::GetLabelForCommandId(int command_id) const { 27990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (command_id == TOGGLE_PIN) { 28090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return controller_->IsAppPinned(app_id_) ? 28190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : 28290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN); 28390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == LAUNCH_NEW) { 2843240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch#if defined(OS_MACOSX) 2853240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch // Even fullscreen windows launch in a browser tab on Mac. 2863240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch const bool launches_in_tab = true; 2873240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch#else 2883240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch const bool launches_in_tab = IsCommandIdChecked(LAUNCH_TYPE_PINNED_TAB) || 2893240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch IsCommandIdChecked(LAUNCH_TYPE_REGULAR_TAB); 2903240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch#endif 2913240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch return launches_in_tab ? 2923240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) : 2933240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW); 29490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else { 29590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) NOTREACHED(); 29690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return string16(); 29790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 29890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 29990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 30090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool AppContextMenu::IsCommandIdChecked(int command_id) const { 30190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (command_id >= LAUNCH_TYPE_START && command_id < LAUNCH_TYPE_LAST) { 30290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return static_cast<int>(GetExtensionLaunchType(profile_, GetExtension())) + 30390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) LAUNCH_TYPE_START == command_id; 30490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && 30590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { 30690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return extension_menu_items_->IsCommandIdChecked(command_id); 30790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 30890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return false; 30990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 31090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 31190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool AppContextMenu::IsCommandIdEnabled(int command_id) const { 31290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (command_id == TOGGLE_PIN) { 31390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return controller_->CanPin(); 31490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == OPTIONS) { 31590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const ExtensionService* service = 31690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile_)->extension_service(); 31790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 31890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return service->IsExtensionEnabledForLauncher(app_id_) && 31990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extension && 32090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) !extensions::ManifestURL::GetOptionsPage(extension).is_empty(); 32190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == UNINSTALL) { 32290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 32390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const extensions::ManagementPolicy* policy = 32490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extensions::ExtensionSystem::Get(profile_)->management_policy(); 32590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return extension && 32690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) policy->UserMayModifySettings(extension, NULL); 32790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == DETAILS) { 32890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const Extension* extension = GetExtension(); 32990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return extension && extension->from_webstore(); 33090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && 33190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { 33290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return extension_menu_items_->IsCommandIdEnabled(command_id); 33390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == MENU_NEW_WINDOW) { 33490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // "Normal" windows are not allowed when incognito is enforced. 33590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != 33690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IncognitoModePrefs::FORCED; 33790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { 33890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Incognito windows are not allowed when incognito is disabled. 33990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != 34090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) IncognitoModePrefs::DISABLED; 34190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 34290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return true; 34390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 34490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 34590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool AppContextMenu::GetAcceleratorForCommandId( 34690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) int command_id, 34790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ui::Accelerator* acclelrator) { 34890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return false; 34990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 35090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 35190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void AppContextMenu::ExecuteCommand(int command_id, int event_flags) { 35290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (command_id == LAUNCH_NEW) { 35390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) delegate_->ExecuteLaunchCommand(event_flags); 35490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == TOGGLE_PIN && controller_->CanPin()) { 35590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (controller_->IsAppPinned(app_id_)) 35690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->UnpinApp(app_id_); 35790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) else 35890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->PinApp(app_id_); 35990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == CREATE_SHORTCUTS) { 360eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch controller_->DoCreateShortcutsFlow(profile_, app_id_); 36190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id >= LAUNCH_TYPE_START && 36290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) command_id < LAUNCH_TYPE_LAST) { 36390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) SetExtensionLaunchType(profile_, 36490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) app_id_, 36590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) static_cast<extensions::ExtensionPrefs::LaunchType>( 36690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) command_id - LAUNCH_TYPE_START)); 36790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == OPTIONS) { 36890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ShowExtensionOptions(); 36990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == UNINSTALL) { 37090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) StartExtensionUninstall(); 37190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == DETAILS) { 37290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) ShowExtensionDetails(); 37390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && 37490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { 37590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) extension_menu_items_->ExecuteCommand(command_id, NULL, 37690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) content::ContextMenuParams()); 37790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == MENU_NEW_WINDOW) { 37890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->CreateNewWindow(profile_, false); 37990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { 38090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) controller_->CreateNewWindow(profile_, true); 38190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) } 38290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 38390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 38490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} // namespace app_list 385