| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const int kMouseMoveTimeMS = 200; | 107 const int kMouseMoveTimeMS = 200; |
| 108 const int kMouseMoveCountBeforeConsiderReal = 3; | 108 const int kMouseMoveCountBeforeConsiderReal = 3; |
| 109 #endif | 109 #endif |
| 110 | 110 |
| 111 // Amount of time we delay before resizing after a close from a touch. | 111 // Amount of time we delay before resizing after a close from a touch. |
| 112 const int kTouchResizeLayoutTimeMS = 2000; | 112 const int kTouchResizeLayoutTimeMS = 2000; |
| 113 | 113 |
| 114 // Amount the left edge of a tab is offset from the rectangle of the tab's | 114 // Amount the left edge of a tab is offset from the rectangle of the tab's |
| 115 // favicon/title/close box. Related to the width of IDR_TAB_ACTIVE_LEFT. | 115 // favicon/title/close box. Related to the width of IDR_TAB_ACTIVE_LEFT. |
| 116 // Affects the size of the "V" between adjacent tabs. | 116 // Affects the size of the "V" between adjacent tabs. |
| 117 #if defined(OS_MACOSX) |
| 118 const int kTabHorizontalOffset = -19; |
| 119 #else |
| 117 const int kTabHorizontalOffset = -26; | 120 const int kTabHorizontalOffset = -26; |
| 121 #endif |
| 118 | 122 |
| 119 // Amount to adjust the clip by when the tab is stacked before the active index. | 123 // Amount to adjust the clip by when the tab is stacked before the active index. |
| 120 const int kStackedTabLeftClip = 20; | 124 const int kStackedTabLeftClip = 20; |
| 121 | 125 |
| 122 // Amount to adjust the clip by when the tab is stacked after the active index. | 126 // Amount to adjust the clip by when the tab is stacked after the active index. |
| 123 const int kStackedTabRightClip = 20; | 127 const int kStackedTabRightClip = 20; |
| 124 | 128 |
| 125 base::string16 GetClipboardText() { | 129 base::string16 GetClipboardText() { |
| 126 if (!ui::Clipboard::IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) | 130 if (!ui::Clipboard::IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) |
| 127 return base::string16(); | 131 return base::string16(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 void TabStrip::RemoveTabDelegate::AnimationCanceled( | 518 void TabStrip::RemoveTabDelegate::AnimationCanceled( |
| 515 const gfx::Animation* animation) { | 519 const gfx::Animation* animation) { |
| 516 AnimationEnded(animation); | 520 AnimationEnded(animation); |
| 517 } | 521 } |
| 518 | 522 |
| 519 /////////////////////////////////////////////////////////////////////////////// | 523 /////////////////////////////////////////////////////////////////////////////// |
| 520 // TabStrip, public: | 524 // TabStrip, public: |
| 521 | 525 |
| 522 // static | 526 // static |
| 523 const char TabStrip::kViewClassName[] = "TabStrip"; | 527 const char TabStrip::kViewClassName[] = "TabStrip"; |
| 524 const int TabStrip::kNewTabButtonHorizontalOffset = -11; | |
| 525 const int TabStrip::kNewTabButtonVerticalOffset = 7; | 528 const int TabStrip::kNewTabButtonVerticalOffset = 7; |
| 526 const int TabStrip::kMiniToNonMiniGap = 3; | |
| 527 const int TabStrip::kNewTabButtonAssetWidth = 34; | 529 const int TabStrip::kNewTabButtonAssetWidth = 34; |
| 528 const int TabStrip::kNewTabButtonAssetHeight = 18; | 530 const int TabStrip::kNewTabButtonAssetHeight = 18; |
| 531 #if defined(OS_MACOSX) |
| 532 const int TabStrip::kNewTabButtonHorizontalOffset = -8; |
| 533 const int TabStrip::kMiniToNonMiniGap = 2; |
| 534 #else |
| 535 const int TabStrip::kNewTabButtonHorizontalOffset = -11; |
| 536 const int TabStrip::kMiniToNonMiniGap = 3; |
| 537 #endif |
| 529 | 538 |
| 530 TabStrip::TabStrip(TabStripController* controller) | 539 TabStrip::TabStrip(TabStripController* controller) |
| 531 : controller_(controller), | 540 : controller_(controller), |
| 532 newtab_button_(NULL), | 541 newtab_button_(NULL), |
| 533 current_unselected_width_(Tab::GetStandardSize().width()), | 542 current_unselected_width_(Tab::GetStandardSize().width()), |
| 534 current_selected_width_(Tab::GetStandardSize().width()), | 543 current_selected_width_(Tab::GetStandardSize().width()), |
| 535 available_width_for_tabs_(-1), | 544 available_width_for_tabs_(-1), |
| 536 in_tab_close_(false), | 545 in_tab_close_(false), |
| 537 animation_container_(new gfx::AnimationContainer()), | 546 animation_container_(new gfx::AnimationContainer()), |
| 538 bounds_animator_(this), | 547 bounds_animator_(this), |
| (...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2759 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2751 if (view) | 2760 if (view) |
| 2752 return view; | 2761 return view; |
| 2753 } | 2762 } |
| 2754 Tab* tab = FindTabForEvent(point); | 2763 Tab* tab = FindTabForEvent(point); |
| 2755 if (tab) | 2764 if (tab) |
| 2756 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2765 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2757 } | 2766 } |
| 2758 return this; | 2767 return this; |
| 2759 } | 2768 } |
| OLD | NEW |