| 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/launcher_button.h" | 7 #include "ash/launcher/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/tabbed_launcher_button.h" | 10 #include "ash/launcher/tabbed_launcher_button.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/base/animation/throb_animation.h" | 21 #include "ui/base/animation/throb_animation.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/models/simple_menu_model.h" | 23 #include "ui/base/models/simple_menu_model.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/compositor/layer.h" | 25 #include "ui/gfx/compositor/layer.h" |
| 26 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
| 27 #include "ui/views/animation/bounds_animator.h" | 27 #include "ui/views/animation/bounds_animator.h" |
| 28 #include "ui/views/controls/button/image_button.h" | 28 #include "ui/views/controls/button/image_button.h" |
| 29 #include "ui/views/controls/menu/menu_model_adapter.h" | 29 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 30 #include "ui/views/controls/menu/menu_runner.h" | 30 #include "ui/views/controls/menu/menu_runner.h" |
| 31 #include "ui/views/widget/root_view.h" |
| 31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 32 | 33 |
| 33 using ui::Animation; | 34 using ui::Animation; |
| 34 using views::View; | 35 using views::View; |
| 35 | 36 |
| 36 namespace ash { | 37 namespace ash { |
| 37 namespace internal { | 38 namespace internal { |
| 38 | 39 |
| 39 // Amount content is inset on the left edge. | 40 // Amount content is inset on the left edge. |
| 40 static const int kLeadingInset = 8; | 41 static const int kLeadingInset = 8; |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 677 |
| 677 switch (model_->items()[view_index].type) { | 678 switch (model_->items()[view_index].type) { |
| 678 case TYPE_TABBED: | 679 case TYPE_TABBED: |
| 679 case TYPE_APP_SHORTCUT: | 680 case TYPE_APP_SHORTCUT: |
| 680 return delegate_->GetTitle(model_->items()[view_index]); | 681 return delegate_->GetTitle(model_->items()[view_index]); |
| 681 | 682 |
| 682 case TYPE_APP_LIST: | 683 case TYPE_APP_LIST: |
| 683 return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); | 684 return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); |
| 684 | 685 |
| 685 case TYPE_BROWSER_SHORTCUT: | 686 case TYPE_BROWSER_SHORTCUT: |
| 686 return l10n_util::GetStringUTF16(IDS_AURA_CYCLER_TITLE); | 687 return l10n_util::GetStringUTF16(IDS_AURA_NEW_TAB); |
| 687 | 688 |
| 688 } | 689 } |
| 689 return string16(); | 690 return string16(); |
| 690 } | 691 } |
| 691 | 692 |
| 692 void LauncherView::ButtonPressed(views::Button* sender, | 693 void LauncherView::ButtonPressed(views::Button* sender, |
| 693 const views::Event& event) { | 694 const views::Event& event) { |
| 694 // Do not handle mouse release during drag. | 695 // Do not handle mouse release during drag. |
| 695 if (dragging_) | 696 if (dragging_) |
| 696 return; | 697 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 709 case TYPE_TABBED: | 710 case TYPE_TABBED: |
| 710 case TYPE_APP_SHORTCUT: | 711 case TYPE_APP_SHORTCUT: |
| 711 delegate_->ItemClicked(model_->items()[view_index]); | 712 delegate_->ItemClicked(model_->items()[view_index]); |
| 712 break; | 713 break; |
| 713 | 714 |
| 714 case TYPE_APP_LIST: | 715 case TYPE_APP_LIST: |
| 715 Shell::GetInstance()->ToggleAppList(); | 716 Shell::GetInstance()->ToggleAppList(); |
| 716 break; | 717 break; |
| 717 | 718 |
| 718 case TYPE_BROWSER_SHORTCUT: | 719 case TYPE_BROWSER_SHORTCUT: |
| 719 delegate_->CreateNewTab(); | 720 if (event.flags() & ui::EF_CONTROL_DOWN) |
| 721 delegate_->CreateNewWindow(); |
| 722 else |
| 723 delegate_->CreateNewTab(); |
| 720 break; | 724 break; |
| 721 } | 725 } |
| 722 } | 726 } |
| 723 | 727 |
| 724 void LauncherView::ShowContextMenuForView(views::View* source, | 728 void LauncherView::ShowContextMenuForView(views::View* source, |
| 725 const gfx::Point& point) { | 729 const gfx::Point& point) { |
| 726 int view_index = view_model_->GetIndexOfView(source); | 730 int view_index = view_model_->GetIndexOfView(source); |
| 727 // May be -1 while in the process of animating closed. | 731 // May be -1 while in the process of animating closed. |
| 728 if (view_index == -1 || !delegate_) | 732 if (view_index == -1 || !delegate_) |
| 729 return; | 733 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 742 // code. | 746 // code. |
| 743 if (launcher_menu_runner_->RunMenuAt( | 747 if (launcher_menu_runner_->RunMenuAt( |
| 744 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 748 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
| 745 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 749 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
| 746 return; | 750 return; |
| 747 #endif | 751 #endif |
| 748 } | 752 } |
| 749 | 753 |
| 750 } // namespace internal | 754 } // namespace internal |
| 751 } // namespace ash | 755 } // namespace ash |
| OLD | NEW |