| 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 "ui/app_list/app_list_menu.h" | 5 #include "ui/app_list/app_list_menu.h" |
| 6 | 6 |
| 7 #include "grit/ui_strings.h" | 7 #include "grit/ui_strings.h" |
| 8 #include "ui/app_list/app_list_view_delegate.h" | 8 #include "ui/app_list/app_list_view_delegate.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/models/menu_separator_types.h" | 10 #include "ui/base/models/menu_separator_types.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 | 12 |
| 13 namespace app_list { | 13 namespace app_list { |
| 14 | 14 |
| 15 AppListMenu::AppListMenu(AppListViewDelegate* delegate) | 15 AppListMenu::AppListMenu(AppListViewDelegate* delegate) |
| 16 : ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), | 16 : ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), |
| 17 delegate_(delegate) { | 17 delegate_(delegate) { |
| 18 InitMenu(); | 18 InitMenu(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 AppListMenu::~AppListMenu() {} | 21 AppListMenu::~AppListMenu() {} |
| 22 | 22 |
| 23 void AppListMenu::InitMenu() { | 23 void AppListMenu::InitMenu() { |
| 24 menu_model_.AddItem(CURRENT_USER, string16()); | 24 menu_model_.AddItem(CURRENT_USER, string16()); |
| 25 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 25 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 26 | 26 |
| 27 menu_model_.AddItem(SHOW_SETTINGS, l10n_util::GetStringUTF16( | 27 menu_model_.AddItem(SHOW_SETTINGS, l10n_util::GetStringUTF16( |
| 28 IDS_APP_LIST_OPEN_SETTINGS)); | 28 IDS_APP_LIST_OPEN_SETTINGS)); |
| 29 | 29 |
| 30 menu_model_.AddItem(SHOW_HELP, l10n_util::GetStringUTF16( |
| 31 IDS_APP_LIST_HELP)); |
| 32 |
| 30 menu_model_.AddItem(SHOW_FEEDBACK, l10n_util::GetStringUTF16( | 33 menu_model_.AddItem(SHOW_FEEDBACK, l10n_util::GetStringUTF16( |
| 31 IDS_APP_LIST_OPEN_FEEDBACK)); | 34 IDS_APP_LIST_OPEN_FEEDBACK)); |
| 32 } | 35 } |
| 33 | 36 |
| 34 bool AppListMenu::IsCommandIdChecked(int command_id) const { | 37 bool AppListMenu::IsCommandIdChecked(int command_id) const { |
| 35 return false; | 38 return false; |
| 36 } | 39 } |
| 37 | 40 |
| 38 bool AppListMenu::IsCommandIdEnabled(int command_id) const { | 41 bool AppListMenu::IsCommandIdEnabled(int command_id) const { |
| 39 return true; | 42 return true; |
| 40 } | 43 } |
| 41 | 44 |
| 42 bool AppListMenu::GetAcceleratorForCommandId(int command_id, | 45 bool AppListMenu::GetAcceleratorForCommandId(int command_id, |
| 43 ui::Accelerator* accelerator) { | 46 ui::Accelerator* accelerator) { |
| 44 return false; | 47 return false; |
| 45 } | 48 } |
| 46 | 49 |
| 47 void AppListMenu::ExecuteCommand(int command_id, int event_flags) { | 50 void AppListMenu::ExecuteCommand(int command_id, int event_flags) { |
| 48 switch (command_id) { | 51 switch (command_id) { |
| 49 case CURRENT_USER: | 52 case CURRENT_USER: |
| 50 break; // Do nothing. | 53 break; // Do nothing. |
| 51 case SHOW_SETTINGS: | 54 case SHOW_SETTINGS: |
| 52 delegate_->OpenSettings(); | 55 delegate_->OpenSettings(); |
| 53 break; | 56 break; |
| 57 case SHOW_HELP: |
| 58 delegate_->OpenHelp(); |
| 59 break; |
| 54 case SHOW_FEEDBACK: | 60 case SHOW_FEEDBACK: |
| 55 delegate_->OpenFeedback(); | 61 delegate_->OpenFeedback(); |
| 56 break; | 62 break; |
| 57 default: | 63 default: |
| 58 NOTREACHED(); | 64 NOTREACHED(); |
| 59 } | 65 } |
| 60 } | 66 } |
| 61 | 67 |
| 62 } // namespace app_list | 68 } // namespace app_list |
| OLD | NEW |