| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #include "app/animation_container.h" | 7 #include "app/animation_container.h" |
| 8 #include "app/drag_drop_types.h" | 8 #include "app/drag_drop_types.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const int TabStrip::mini_to_non_mini_gap_ = 3; | 122 const int TabStrip::mini_to_non_mini_gap_ = 3; |
| 123 | 123 |
| 124 TabStrip::TabStrip(TabStripController* controller) | 124 TabStrip::TabStrip(TabStripController* controller) |
| 125 : BaseTabStrip(controller, BaseTabStrip::HORIZONTAL_TAB_STRIP), | 125 : BaseTabStrip(controller, BaseTabStrip::HORIZONTAL_TAB_STRIP), |
| 126 resize_layout_factory_(this), | 126 resize_layout_factory_(this), |
| 127 added_as_message_loop_observer_(false), | 127 added_as_message_loop_observer_(false), |
| 128 current_unselected_width_(Tab::GetStandardSize().width()), | 128 current_unselected_width_(Tab::GetStandardSize().width()), |
| 129 current_selected_width_(Tab::GetStandardSize().width()), | 129 current_selected_width_(Tab::GetStandardSize().width()), |
| 130 available_width_for_tabs_(-1), | 130 available_width_for_tabs_(-1), |
| 131 in_tab_close_(false), | 131 in_tab_close_(false), |
| 132 animation_container_(new AnimationContainer()), | 132 animation_container_(new AnimationContainer()) { |
| 133 new_tab_button_enabled_(true) { | |
| 134 Init(); | 133 Init(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 TabStrip::~TabStrip() { | 136 TabStrip::~TabStrip() { |
| 138 // The animations may reference the tabs. Shut down the animation before we | 137 // The animations may reference the tabs. Shut down the animation before we |
| 139 // delete the tabs. | 138 // delete the tabs. |
| 140 StopAnimating(false); | 139 StopAnimating(false); |
| 141 | 140 |
| 142 DestroyDragController(); | 141 DestroyDragController(); |
| 143 | 142 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 367 } |
| 369 } | 368 } |
| 370 } | 369 } |
| 371 | 370 |
| 372 return View::GetViewByID(view_id); | 371 return View::GetViewByID(view_id); |
| 373 } | 372 } |
| 374 | 373 |
| 375 void TabStrip::Layout() { | 374 void TabStrip::Layout() { |
| 376 BaseTabStrip::Layout(); | 375 BaseTabStrip::Layout(); |
| 377 | 376 |
| 378 if (new_tab_button_enabled_) { | 377 newtab_button_->SetBounds(newtab_button_bounds_); |
| 379 newtab_button_->SetBounds(newtab_button_bounds_); | 378 |
| 380 newtab_button_->SetVisible(true); | 379 SchedulePaint(); |
| 381 } else { | |
| 382 newtab_button_->SetVisible(false); | |
| 383 } | |
| 384 } | 380 } |
| 385 | 381 |
| 386 gfx::Size TabStrip::GetPreferredSize() { | 382 gfx::Size TabStrip::GetPreferredSize() { |
| 387 return gfx::Size(0, Tab::GetMinimumUnselectedSize().height()); | 383 return gfx::Size(0, Tab::GetMinimumUnselectedSize().height()); |
| 388 } | 384 } |
| 389 | 385 |
| 390 void TabStrip::OnDragEntered(const DropTargetEvent& event) { | 386 void TabStrip::OnDragEntered(const DropTargetEvent& event) { |
| 391 // Force animations to stop, otherwise it makes the index calculation tricky. | 387 // Force animations to stop, otherwise it makes the index calculation tricky. |
| 392 StopAnimating(true); | 388 StopAnimating(true); |
| 393 | 389 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 } | 1124 } |
| 1129 } | 1125 } |
| 1130 | 1126 |
| 1131 bool TabStrip::HasPhantomTabs() const { | 1127 bool TabStrip::HasPhantomTabs() const { |
| 1132 for (int i = 0; i < tab_count(); ++i) { | 1128 for (int i = 0; i < tab_count(); ++i) { |
| 1133 if (GetTabAtTabDataIndex(i)->data().phantom) | 1129 if (GetTabAtTabDataIndex(i)->data().phantom) |
| 1134 return true; | 1130 return true; |
| 1135 } | 1131 } |
| 1136 return false; | 1132 return false; |
| 1137 } | 1133 } |
| OLD | NEW |