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/base_tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/title_prefix_matcher.h" | 8 #include "chrome/browser/ui/title_prefix_matcher.h" |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" | 10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 DCHECK(tab != NULL); | 469 DCHECK(tab != NULL); |
470 return tab->data().mini || tab->data().title.empty(); | 470 return tab->data().mini || tab->data().title.empty(); |
471 } | 471 } |
472 | 472 |
473 void BaseTabStrip::UpdateCommonTitlePrefix() { | 473 void BaseTabStrip::UpdateCommonTitlePrefix() { |
474 std::vector<TitlePrefixMatcher::TitleInfo> tab_title_infos; | 474 std::vector<TitlePrefixMatcher::TitleInfo> tab_title_infos; |
475 for (int tab_index = 0; tab_index < tab_count(); ++tab_index) { | 475 for (int tab_index = 0; tab_index < tab_count(); ++tab_index) { |
476 DCHECK(tab_data_[tab_index].tab != NULL); | 476 DCHECK(tab_data_[tab_index].tab != NULL); |
477 if (!IgnoreTitlePrefixEliding(tab_data_[tab_index].tab)) { | 477 if (!IgnoreTitlePrefixEliding(tab_data_[tab_index].tab)) { |
478 tab_title_infos.push_back(TitlePrefixMatcher::TitleInfo( | 478 tab_title_infos.push_back(TitlePrefixMatcher::TitleInfo( |
479 &tab_data_[tab_index].tab->data().title, tab_index)); | 479 &tab_data_[tab_index].tab->data().title, |
| 480 tab_data_[tab_index].tab->data().url, |
| 481 tab_index)); |
480 } | 482 } |
481 } | 483 } |
482 TitlePrefixMatcher::CalculatePrefixLengths(&tab_title_infos); | 484 TitlePrefixMatcher::CalculatePrefixLengths(&tab_title_infos); |
483 for (size_t title_index = 0; title_index < tab_title_infos.size(); | 485 for (size_t title_index = 0; title_index < tab_title_infos.size(); |
484 ++title_index) { | 486 ++title_index) { |
485 int tab_index = tab_title_infos[title_index].caller_value; | 487 int tab_index = tab_title_infos[title_index].caller_value; |
486 TabRendererData data = tab_data_[tab_index].tab->data(); | 488 TabRendererData data = tab_data_[tab_index].tab->data(); |
487 if (data.common_prefix_length != | 489 if (data.common_prefix_length != |
488 tab_title_infos[title_index].prefix_length) { | 490 tab_title_infos[title_index].prefix_length) { |
489 data.common_prefix_length = tab_title_infos[title_index].prefix_length; | 491 data.common_prefix_length = tab_title_infos[title_index].prefix_length; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // Animate the view back to its correct position. | 585 // Animate the view back to its correct position. |
584 GenerateIdealBounds(); | 586 GenerateIdealBounds(); |
585 AnimateToIdealBounds(); | 587 AnimateToIdealBounds(); |
586 } | 588 } |
587 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 589 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); |
588 // Install a delegate to reset the dragging state when done. We have to leave | 590 // Install a delegate to reset the dragging state when done. We have to leave |
589 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 591 // dragging true for the tab otherwise it'll draw beneath the new tab button. |
590 bounds_animator_.SetAnimationDelegate( | 592 bounds_animator_.SetAnimationDelegate( |
591 tab, new ResetDraggingStateDelegate(tab), true); | 593 tab, new ResetDraggingStateDelegate(tab), true); |
592 } | 594 } |
OLD | NEW |