Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chrome/browser/ui/profile_menu_model.cc

Issue 7321011: Multi-Profiles: Add delete profile command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug code Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profile_menu_model.h" 5 #include "chrome/browser/ui/profile_menu_model.h"
6 6
7 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
8 #include "grit/chromium_strings.h" 9 #include "grit/chromium_strings.h"
9 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 12
12 ProfileMenuModel::ProfileMenuModel() 13 ProfileMenuModel::ProfileMenuModel(Profile* profile)
13 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)) { 14 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
15 profile_(profile) {
14 const string16 short_product_name = 16 const string16 short_product_name =
15 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); 17 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
16 AddItem(COMMAND_CREATE_NEW_PROFILE, l10n_util::GetStringFUTF16( 18 AddItem(COMMAND_CREATE_NEW_PROFILE, l10n_util::GetStringFUTF16(
17 IDS_PROFILES_CREATE_NEW_PROFILE_OPTION, short_product_name)); 19 IDS_PROFILES_CREATE_NEW_PROFILE_OPTION, short_product_name));
20 AddItemWithStringId(COMMAND_DELETE_PROFILE,
21 IDS_PROFILES_DELETE_PROFILE);
18 } 22 }
19 23
20 ProfileMenuModel::~ProfileMenuModel() { 24 ProfileMenuModel::~ProfileMenuModel() {
21 } 25 }
22 26
23 // ui::SimpleMenuModel::Delegate implementation 27 // ui::SimpleMenuModel::Delegate implementation
24 bool ProfileMenuModel::IsCommandIdChecked(int command_id) const { 28 bool ProfileMenuModel::IsCommandIdChecked(int command_id) const {
25 return false; 29 return false;
26 } 30 }
27 31
28 bool ProfileMenuModel::IsCommandIdEnabled(int command_id) const { 32 bool ProfileMenuModel::IsCommandIdEnabled(int command_id) const {
29 return true; 33 return true;
30 } 34 }
31 35
32 bool ProfileMenuModel::GetAcceleratorForCommandId(int command_id, 36 bool ProfileMenuModel::GetAcceleratorForCommandId(int command_id,
33 ui::Accelerator* accelerator) { 37 ui::Accelerator* accelerator) {
34 return false; 38 return false;
35 } 39 }
36 40
37 void ProfileMenuModel::ExecuteCommand(int command_id) { 41 void ProfileMenuModel::ExecuteCommand(int command_id) {
38 switch (command_id) { 42 switch (command_id) {
39 case COMMAND_CREATE_NEW_PROFILE: 43 case COMMAND_CREATE_NEW_PROFILE:
40 ProfileManager::CreateMultiProfileAsync(); 44 ProfileManager::CreateMultiProfileAsync();
41 break; 45 break;
46 case IDS_PROFILES_DELETE_PROFILE:
47 g_browser_process->profile_manager()->ScheduleProfileForDeletion(
Miranda Callahan 2011/07/07 17:43:02 We probably need to stop background apps for this
sail 2011/07/07 18:00:19 Sounds good. Mind if I do this as a separate chang
Miranda Callahan 2011/07/07 18:24:16 Sure, no problem -- then we can get Rachel in that
48 profile_->GetPath());
49 break;
42 default: 50 default:
43 NOTREACHED(); 51 NOTREACHED();
44 break; 52 break;
45 } 53 }
46 } 54 }
47
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698