| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include "ash/launcher/app_launcher_button.h" | 7 #include "ash/launcher/app_launcher_button.h" |
| 8 #include "ash/launcher/launcher_delegate.h" | 8 #include "ash/launcher/launcher_delegate.h" |
| 9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
| 10 #include "ash/launcher/launcher_window_cycler.h" | 10 #include "ash/launcher/launcher_window_cycler.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 case TYPE_BROWSER_SHORTCUT: | 665 case TYPE_BROWSER_SHORTCUT: |
| 666 cycler_->Cycle(); | 666 cycler_->Cycle(); |
| 667 break; | 667 break; |
| 668 | 668 |
| 669 default: | 669 default: |
| 670 NOTREACHED(); | 670 NOTREACHED(); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 | 673 |
| 674 void LauncherView::ShowContextMenuForView(views::View* source, | 674 void LauncherView::ShowContextMenuForView(views::View* source, |
| 675 const gfx::Point& p, | 675 const gfx::Point& point) { |
| 676 bool is_mouse_gesture) { | |
| 677 int view_index = view_model_->GetIndexOfView(source); | 676 int view_index = view_model_->GetIndexOfView(source); |
| 678 // May be -1 while in the process of animating closed. | 677 // May be -1 while in the process of animating closed. |
| 679 if (view_index == -1 || !delegate_) | 678 if (view_index == -1 || !delegate_) |
| 680 return; | 679 return; |
| 681 | 680 |
| 682 #if !defined(OS_MACOSX) | 681 #if !defined(OS_MACOSX) |
| 683 scoped_ptr<ui::MenuModel> menu_model( | 682 scoped_ptr<ui::MenuModel> menu_model( |
| 684 delegate_->CreateContextMenu(model_->items()[view_index])); | 683 delegate_->CreateContextMenu(model_->items()[view_index])); |
| 685 if (!menu_model.get()) | 684 if (!menu_model.get()) |
| 686 return; | 685 return; |
| 687 AutoReset<LauncherID> reseter(&context_menu_id_, | 686 AutoReset<LauncherID> reseter(&context_menu_id_, |
| 688 model_->items()[view_index].id); | 687 model_->items()[view_index].id); |
| 689 views::MenuModelAdapter menu_model_adapter(menu_model.get()); | 688 views::MenuModelAdapter menu_model_adapter(menu_model.get()); |
| 690 launcher_menu_runner_.reset( | 689 launcher_menu_runner_.reset( |
| 691 new views::MenuRunner(menu_model_adapter.CreateMenu())); | 690 new views::MenuRunner(menu_model_adapter.CreateMenu())); |
| 692 // NOTE: if you convert to HAS_MNEMONICS be sure and update menu building | 691 // NOTE: if you convert to HAS_MNEMONICS be sure and update menu building |
| 693 // code. | 692 // code. |
| 694 if (launcher_menu_runner_->RunMenuAt( | 693 if (launcher_menu_runner_->RunMenuAt( |
| 695 source->GetWidget(), NULL, gfx::Rect(p, gfx::Size()), | 694 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
| 696 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 695 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
| 697 return; | 696 return; |
| 698 #endif | 697 #endif |
| 699 } | 698 } |
| 700 | 699 |
| 701 } // namespace internal | 700 } // namespace internal |
| 702 } // namespace ash | 701 } // namespace ash |
| OLD | NEW |