| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 853 |
| 854 // TabStrip::DropInfo ---------------------------------------------------------- | 854 // TabStrip::DropInfo ---------------------------------------------------------- |
| 855 | 855 |
| 856 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) | 856 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) |
| 857 : drop_index(drop_index), | 857 : drop_index(drop_index), |
| 858 drop_before(drop_before), | 858 drop_before(drop_before), |
| 859 point_down(point_down) { | 859 point_down(point_down) { |
| 860 arrow_view = new views::ImageView; | 860 arrow_view = new views::ImageView; |
| 861 arrow_view->SetImage(GetDropArrowImage(point_down)); | 861 arrow_view->SetImage(GetDropArrowImage(point_down)); |
| 862 | 862 |
| 863 arrow_window = views::Widget::CreateWidget(); |
| 863 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 864 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 864 params.keep_on_top = true; | 865 params.keep_on_top = true; |
| 865 params.transparent = true; | 866 params.transparent = true; |
| 866 params.accept_events = false; | 867 params.accept_events = false; |
| 867 params.can_activate = false; | 868 params.can_activate = false; |
| 868 arrow_window = views::Widget::CreateWidget(params); | 869 params.bounds = gfx::Rect(drop_indicator_width, drop_indicator_height); |
| 869 arrow_window->Init( | 870 arrow_window->Init(params); |
| 870 NULL, | |
| 871 gfx::Rect(0, 0, drop_indicator_width, drop_indicator_height)); | |
| 872 arrow_window->SetContentsView(arrow_view); | 871 arrow_window->SetContentsView(arrow_view); |
| 873 } | 872 } |
| 874 | 873 |
| 875 TabStrip::DropInfo::~DropInfo() { | 874 TabStrip::DropInfo::~DropInfo() { |
| 876 // Close eventually deletes the window, which deletes arrow_view too. | 875 // Close eventually deletes the window, which deletes arrow_view too. |
| 877 arrow_window->Close(); | 876 arrow_window->Close(); |
| 878 } | 877 } |
| 879 | 878 |
| 880 /////////////////////////////////////////////////////////////////////////////// | 879 /////////////////////////////////////////////////////////////////////////////// |
| 881 | 880 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { | 1020 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { |
| 1022 return last_tab->x() + last_tab->width(); | 1021 return last_tab->x() + last_tab->width(); |
| 1023 } | 1022 } |
| 1024 | 1023 |
| 1025 bool TabStrip::IsPointInTab(Tab* tab, | 1024 bool TabStrip::IsPointInTab(Tab* tab, |
| 1026 const gfx::Point& point_in_tabstrip_coords) { | 1025 const gfx::Point& point_in_tabstrip_coords) { |
| 1027 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1026 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
| 1028 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1027 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
| 1029 return tab->HitTest(point_in_tab_coords); | 1028 return tab->HitTest(point_in_tab_coords); |
| 1030 } | 1029 } |
| OLD | NEW |