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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 /////////////////////////////////////////////////////////////////////////////// | 547 /////////////////////////////////////////////////////////////////////////////// |
548 // TabStrip, public: | 548 // TabStrip, public: |
549 | 549 |
550 // static | 550 // static |
551 const char TabStrip::kViewClassName[] = "TabStrip"; | 551 const char TabStrip::kViewClassName[] = "TabStrip"; |
552 | 552 |
553 // static | 553 // static |
554 const int TabStrip::kMiniToNonMiniGap = 3; | 554 const int TabStrip::kMiniToNonMiniGap = 3; |
555 | 555 |
556 TabStrip::TabStrip(TabStripController* controller) | 556 TabStrip::TabStrip(TabStripController* controller, |
| 557 bool instant_extended_api_enabled) |
557 : controller_(controller), | 558 : controller_(controller), |
| 559 instant_extended_api_enabled_(instant_extended_api_enabled), |
558 newtab_button_(NULL), | 560 newtab_button_(NULL), |
559 current_unselected_width_(Tab::GetStandardSize().width()), | 561 current_unselected_width_(Tab::GetStandardSize().width()), |
560 current_selected_width_(Tab::GetStandardSize().width()), | 562 current_selected_width_(Tab::GetStandardSize().width()), |
561 available_width_for_tabs_(-1), | 563 available_width_for_tabs_(-1), |
562 in_tab_close_(false), | 564 in_tab_close_(false), |
563 animation_container_(new ui::AnimationContainer()), | 565 animation_container_(new ui::AnimationContainer()), |
564 ALLOW_THIS_IN_INITIALIZER_LIST(bounds_animator_(this)), | 566 ALLOW_THIS_IN_INITIALIZER_LIST(bounds_animator_(this)), |
565 layout_type_(TAB_STRIP_LAYOUT_SHRINK), | 567 layout_type_(TAB_STRIP_LAYOUT_SHRINK), |
566 adjust_layout_(false), | 568 adjust_layout_(false), |
567 reset_to_shrink_on_release_(false), | 569 reset_to_shrink_on_release_(false), |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 | 1104 |
1103 if (previous_tab_bounds.right() + tab_h_offset() != tab_bounds.x()) { | 1105 if (previous_tab_bounds.right() + tab_h_offset() != tab_bounds.x()) { |
1104 int x = previous_tab_bounds.right() - tab_bounds.x() - | 1106 int x = previous_tab_bounds.right() - tab_bounds.x() - |
1105 stacked_tab_right_clip(); | 1107 stacked_tab_right_clip(); |
1106 clip->SetRect(x, 0, tab_bounds.width() - x, tab_bounds.height()); | 1108 clip->SetRect(x, 0, tab_bounds.width() - x, tab_bounds.height()); |
1107 } | 1109 } |
1108 } | 1110 } |
1109 return true; | 1111 return true; |
1110 } | 1112 } |
1111 | 1113 |
| 1114 bool TabStrip::IsInstantExtendedAPIEnabled() { |
| 1115 return instant_extended_api_enabled_; |
| 1116 } |
| 1117 |
1112 void TabStrip::MouseMovedOutOfHost() { | 1118 void TabStrip::MouseMovedOutOfHost() { |
1113 ResizeLayoutTabs(); | 1119 ResizeLayoutTabs(); |
1114 } | 1120 } |
1115 | 1121 |
1116 /////////////////////////////////////////////////////////////////////////////// | 1122 /////////////////////////////////////////////////////////////////////////////// |
1117 // TabStrip, views::View overrides: | 1123 // TabStrip, views::View overrides: |
1118 | 1124 |
1119 void TabStrip::Layout() { | 1125 void TabStrip::Layout() { |
1120 // Only do a layout if our size changed. | 1126 // Only do a layout if our size changed. |
1121 if (last_layout_size_ == size()) | 1127 if (last_layout_size_ == size()) |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 | 2336 |
2331 int mini_tab_count = GetMiniTabCount(); | 2337 int mini_tab_count = GetMiniTabCount(); |
2332 int normal_count = tab_count() - mini_tab_count; | 2338 int normal_count = tab_count() - mini_tab_count; |
2333 if (normal_count == 0 || normal_count == mini_tab_count) | 2339 if (normal_count == 0 || normal_count == mini_tab_count) |
2334 return false; | 2340 return false; |
2335 int x = GetStartXForNormalTabs(); | 2341 int x = GetStartXForNormalTabs(); |
2336 int available_width = width() - x - new_tab_button_width(); | 2342 int available_width = width() - x - new_tab_button_width(); |
2337 return (Tab::GetTouchWidth() * normal_count + | 2343 return (Tab::GetTouchWidth() * normal_count + |
2338 tab_h_offset() * (normal_count - 1)) > available_width; | 2344 tab_h_offset() * (normal_count - 1)) > available_width; |
2339 } | 2345 } |
OLD | NEW |