Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/ui/views/tabs/base_tab_strip.cc

Issue 6783015: Improvements to tab title prefix eliding as per email discussions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 DCHECK(tab != NULL); 473 DCHECK(tab != NULL);
474 return tab->data().mini || tab->data().title.empty(); 474 return tab->data().mini || tab->data().title.empty();
475 } 475 }
476 476
477 void BaseTabStrip::UpdateCommonTitlePrefix() { 477 void BaseTabStrip::UpdateCommonTitlePrefix() {
478 std::vector<TitlePrefixMatcher::TitleInfo> tab_title_infos; 478 std::vector<TitlePrefixMatcher::TitleInfo> tab_title_infos;
479 for (int tab_index = 0; tab_index < tab_count(); ++tab_index) { 479 for (int tab_index = 0; tab_index < tab_count(); ++tab_index) {
480 DCHECK(tab_data_[tab_index].tab != NULL); 480 DCHECK(tab_data_[tab_index].tab != NULL);
481 if (!IgnoreTitlePrefixEliding(tab_data_[tab_index].tab)) { 481 if (!IgnoreTitlePrefixEliding(tab_data_[tab_index].tab)) {
482 tab_title_infos.push_back(TitlePrefixMatcher::TitleInfo( 482 tab_title_infos.push_back(TitlePrefixMatcher::TitleInfo(
483 &tab_data_[tab_index].tab->data().title, tab_index)); 483 &tab_data_[tab_index].tab->data().title,
484 tab_data_[tab_index].tab->data().url,
485 tab_index));
484 } 486 }
485 } 487 }
486 TitlePrefixMatcher::CalculatePrefixLengths(&tab_title_infos); 488 TitlePrefixMatcher::CalculatePrefixLengths(&tab_title_infos);
487 for (size_t title_index = 0; title_index < tab_title_infos.size(); 489 for (size_t title_index = 0; title_index < tab_title_infos.size();
488 ++title_index) { 490 ++title_index) {
489 int tab_index = tab_title_infos[title_index].caller_value; 491 int tab_index = tab_title_infos[title_index].caller_value;
490 TabRendererData data = tab_data_[tab_index].tab->data(); 492 TabRendererData data = tab_data_[tab_index].tab->data();
491 if (data.common_prefix_length != 493 if (data.common_prefix_length !=
492 tab_title_infos[title_index].prefix_length) { 494 tab_title_infos[title_index].prefix_length) {
493 data.common_prefix_length = tab_title_infos[title_index].prefix_length; 495 data.common_prefix_length = tab_title_infos[title_index].prefix_length;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // Animate the view back to its correct position. 589 // Animate the view back to its correct position.
588 GenerateIdealBounds(); 590 GenerateIdealBounds();
589 AnimateToIdealBounds(); 591 AnimateToIdealBounds();
590 } 592 }
591 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); 593 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab)));
592 // Install a delegate to reset the dragging state when done. We have to leave 594 // Install a delegate to reset the dragging state when done. We have to leave
593 // dragging true for the tab otherwise it'll draw beneath the new tab button. 595 // dragging true for the tab otherwise it'll draw beneath the new tab button.
594 bounds_animator_.SetAnimationDelegate( 596 bounds_animator_.SetAnimationDelegate(
595 tab, new ResetDraggingStateDelegate(tab), true); 597 tab, new ResetDraggingStateDelegate(tab), true);
596 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698