OLD | NEW |
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/profiles/profile_manager.h" |
7 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
8 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
9 | 10 |
10 ProfileMenuModel::ProfileMenuModel(ui::SimpleMenuModel::Delegate* delegate) | 11 ProfileMenuModel::ProfileMenuModel() |
11 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(delegate)) { | 12 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)) { |
12 AddItem(COMMAND_CREATE_NEW_PROFILE, l10n_util::GetStringUTF16( | 13 AddItem(COMMAND_CREATE_NEW_PROFILE, l10n_util::GetStringUTF16( |
13 IDS_PROFILES_CREATE_NEW_PROFILE_OPTION)); | 14 IDS_PROFILES_CREATE_NEW_PROFILE_OPTION)); |
14 } | 15 } |
15 | 16 |
16 ProfileMenuModel::~ProfileMenuModel() { | 17 ProfileMenuModel::~ProfileMenuModel() { |
17 } | 18 } |
| 19 |
| 20 // ui::SimpleMenuModel::Delegate implementation |
| 21 bool ProfileMenuModel::IsCommandIdChecked(int command_id) const { |
| 22 return false; |
| 23 } |
| 24 |
| 25 bool ProfileMenuModel::IsCommandIdEnabled(int command_id) const { |
| 26 return true; |
| 27 } |
| 28 |
| 29 bool ProfileMenuModel::GetAcceleratorForCommandId(int command_id, |
| 30 ui::Accelerator* accelerator) { |
| 31 return false; |
| 32 } |
| 33 |
| 34 void ProfileMenuModel::ExecuteCommand(int command_id) { |
| 35 switch (command_id) { |
| 36 case COMMAND_CREATE_NEW_PROFILE: |
| 37 ProfileManager::CreateMultiProfileAsync(); |
| 38 break; |
| 39 default: |
| 40 NOTREACHED(); |
| 41 break; |
| 42 } |
| 43 } |
| 44 |
OLD | NEW |