| 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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 // If we get here, it means a tab has been marked as closing but isn't in | 1013 // If we get here, it means a tab has been marked as closing but isn't in |
| 1014 // the set of known closing tabs. | 1014 // the set of known closing tabs. |
| 1015 NOTREACHED(); | 1015 NOTREACHED(); |
| 1016 return; | 1016 return; |
| 1017 } | 1017 } |
| 1018 int model_index = GetModelIndexOfTab(tab); | 1018 int model_index = GetModelIndexOfTab(tab); |
| 1019 if (IsValidModelIndex(model_index)) | 1019 if (IsValidModelIndex(model_index)) |
| 1020 controller_->CloseTab(model_index, source); | 1020 controller_->CloseTab(model_index, source); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 void TabStrip::ShowContextMenuForTab(Tab* tab, const gfx::Point& p) { | 1023 void TabStrip::ShowContextMenuForTab(Tab* tab, |
| 1024 controller_->ShowContextMenuForTab(tab, p); | 1024 const gfx::Point& p, |
| 1025 ui::MenuSourceType source_type) { |
| 1026 controller_->ShowContextMenuForTab(tab, p, source_type); |
| 1025 } | 1027 } |
| 1026 | 1028 |
| 1027 bool TabStrip::IsActiveTab(const Tab* tab) const { | 1029 bool TabStrip::IsActiveTab(const Tab* tab) const { |
| 1028 int model_index = GetModelIndexOfTab(tab); | 1030 int model_index = GetModelIndexOfTab(tab); |
| 1029 return IsValidModelIndex(model_index) && | 1031 return IsValidModelIndex(model_index) && |
| 1030 controller_->IsActiveTab(model_index); | 1032 controller_->IsActiveTab(model_index); |
| 1031 } | 1033 } |
| 1032 | 1034 |
| 1033 bool TabStrip::IsTabSelected(const Tab* tab) const { | 1035 bool TabStrip::IsTabSelected(const Tab* tab) const { |
| 1034 int model_index = GetModelIndexOfTab(tab); | 1036 int model_index = GetModelIndexOfTab(tab); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 if (drag_controller_.get()) | 1562 if (drag_controller_.get()) |
| 1561 drag_controller_->SetMoveBehavior(TabDragController::REORDER); | 1563 drag_controller_->SetMoveBehavior(TabDragController::REORDER); |
| 1562 break; | 1564 break; |
| 1563 | 1565 |
| 1564 case ui::ET_GESTURE_LONG_TAP: { | 1566 case ui::ET_GESTURE_LONG_TAP: { |
| 1565 EndDrag(END_DRAG_CANCEL); | 1567 EndDrag(END_DRAG_CANCEL); |
| 1566 gfx::Point local_point = event->location(); | 1568 gfx::Point local_point = event->location(); |
| 1567 Tab* tab = FindTabForEvent(local_point); | 1569 Tab* tab = FindTabForEvent(local_point); |
| 1568 if (tab) { | 1570 if (tab) { |
| 1569 ConvertPointToScreen(this, &local_point); | 1571 ConvertPointToScreen(this, &local_point); |
| 1570 ShowContextMenuForTab(tab, local_point); | 1572 ShowContextMenuForTab(tab, local_point, ui::MENU_SOURCE_TOUCH); |
| 1571 } | 1573 } |
| 1572 break; | 1574 break; |
| 1573 } | 1575 } |
| 1574 | 1576 |
| 1575 case ui::ET_GESTURE_SCROLL_UPDATE: | 1577 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 1576 ContinueDrag(this, *event); | 1578 ContinueDrag(this, *event); |
| 1577 break; | 1579 break; |
| 1578 | 1580 |
| 1579 case ui::ET_GESTURE_BEGIN: | 1581 case ui::ET_GESTURE_BEGIN: |
| 1580 EndDrag(END_DRAG_CANCEL); | 1582 EndDrag(END_DRAG_CANCEL); |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2689 if (!adjust_layout_) | 2691 if (!adjust_layout_) |
| 2690 return false; | 2692 return false; |
| 2691 | 2693 |
| 2692 #if !defined(OS_CHROMEOS) | 2694 #if !defined(OS_CHROMEOS) |
| 2693 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2695 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
| 2694 return false; | 2696 return false; |
| 2695 #endif | 2697 #endif |
| 2696 | 2698 |
| 2697 return true; | 2699 return true; |
| 2698 } | 2700 } |
| OLD | NEW |