| 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 "chrome/browser/ui/app_list/app_context_menu_delegate.h" | 7 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" |
| 8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool AppContextMenu::IsCommandIdEnabled(int command_id) const { | 79 bool AppContextMenu::IsCommandIdEnabled(int command_id) const { |
| 80 if (command_id == TOGGLE_PIN) { | 80 if (command_id == TOGGLE_PIN) { |
| 81 return controller_->GetPinnable(app_id_) == | 81 return controller_->GetPinnable(app_id_) == |
| 82 AppListControllerDelegate::PIN_EDITABLE; | 82 AppListControllerDelegate::PIN_EDITABLE; |
| 83 } | 83 } |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool AppContextMenu::GetAcceleratorForCommandId( | |
| 88 int command_id, | |
| 89 ui::Accelerator* accelerator) const { | |
| 90 return false; | |
| 91 } | |
| 92 | |
| 93 void AppContextMenu::TogglePin(const std::string& shelf_app_id) { | 87 void AppContextMenu::TogglePin(const std::string& shelf_app_id) { |
| 94 DCHECK_EQ(AppListControllerDelegate::PIN_EDITABLE, | 88 DCHECK_EQ(AppListControllerDelegate::PIN_EDITABLE, |
| 95 controller_->GetPinnable(shelf_app_id)); | 89 controller_->GetPinnable(shelf_app_id)); |
| 96 if (controller_->IsAppPinned(shelf_app_id)) | 90 if (controller_->IsAppPinned(shelf_app_id)) |
| 97 controller_->UnpinApp(shelf_app_id); | 91 controller_->UnpinApp(shelf_app_id); |
| 98 else | 92 else |
| 99 controller_->PinApp(shelf_app_id); | 93 controller_->PinApp(shelf_app_id); |
| 100 } | 94 } |
| 101 | 95 |
| 102 void AppContextMenu::ExecuteCommand(int command_id, int event_flags) { | 96 void AppContextMenu::ExecuteCommand(int command_id, int event_flags) { |
| 103 switch (command_id) { | 97 switch (command_id) { |
| 104 case TOGGLE_PIN: | 98 case TOGGLE_PIN: |
| 105 TogglePin(app_id_); | 99 TogglePin(app_id_); |
| 106 break; | 100 break; |
| 107 case CREATE_SHORTCUTS: | 101 case CREATE_SHORTCUTS: |
| 108 controller_->DoCreateShortcutsFlow(profile_, app_id_); | 102 controller_->DoCreateShortcutsFlow(profile_, app_id_); |
| 109 break; | 103 break; |
| 110 } | 104 } |
| 111 } | 105 } |
| 112 | 106 |
| 113 } // namespace app_list | 107 } // namespace app_list |
| OLD | NEW |