| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 DCHECK(item_delegate); | 120 DCHECK(item_delegate); |
| 121 item_delegate->Close(); | 121 item_delegate->Close(); |
| 122 } else { | 122 } else { |
| 123 // TODO(simonhong): Use ShelfItemDelegate::Close(). | 123 // TODO(simonhong): Use ShelfItemDelegate::Close(). |
| 124 controller_->Close(item_.id); | 124 controller_->Close(item_.id); |
| 125 } | 125 } |
| 126 ash::WmShell::Get()->RecordUserMetricsAction( | 126 ash::WmShell::Get()->RecordUserMetricsAction( |
| 127 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); | 127 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); |
| 128 break; | 128 break; |
| 129 case MENU_PIN: | 129 case MENU_PIN: |
| 130 controller_->TogglePinned(item_.id); | 130 if (controller_->IsAppPinned(item_.app_launch_id.app_id())) |
| 131 controller_->UnpinAppWithID(item_.app_launch_id.app_id()); |
| 132 else |
| 133 controller_->PinAppWithID(item_.app_launch_id.app_id()); |
| 131 break; | 134 break; |
| 132 case MENU_AUTO_HIDE: | 135 case MENU_AUTO_HIDE: |
| 133 wm_shelf_->SetAutoHideBehavior( | 136 wm_shelf_->SetAutoHideBehavior( |
| 134 wm_shelf_->auto_hide_behavior() == | 137 wm_shelf_->auto_hide_behavior() == |
| 135 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS | 138 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS |
| 136 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER | 139 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER |
| 137 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 140 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 138 break; | 141 break; |
| 139 case MENU_ALIGNMENT_MENU: | 142 case MENU_ALIGNMENT_MENU: |
| 140 break; | 143 break; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 case MENU_PIN: | 201 case MENU_PIN: |
| 199 case MENU_AUTO_HIDE: | 202 case MENU_AUTO_HIDE: |
| 200 case MENU_ALIGNMENT_MENU: | 203 case MENU_ALIGNMENT_MENU: |
| 201 case MENU_CHANGE_WALLPAPER: | 204 case MENU_CHANGE_WALLPAPER: |
| 202 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 205 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 203 return true; | 206 return true; |
| 204 default: | 207 default: |
| 205 return false; | 208 return false; |
| 206 } | 209 } |
| 207 } | 210 } |
| OLD | NEW |