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/base_tab.h" | 5 #include "chrome/browser/ui/views/tabs/base_tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : | 540 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : |
541 CoreTabHelper::GetDefaultTitle(); | 541 CoreTabHelper::GetDefaultTitle(); |
542 } else { | 542 } else { |
543 Browser::FormatTitleForDisplay(&title); | 543 Browser::FormatTitleForDisplay(&title); |
544 } | 544 } |
545 | 545 |
546 #if defined(OS_WIN) | 546 #if defined(OS_WIN) |
547 canvas->DrawFadeTruncatingString(title, gfx::Canvas::TruncateFadeTail, 0, | 547 canvas->DrawFadeTruncatingString(title, gfx::Canvas::TruncateFadeTail, 0, |
548 *font_, title_color, title_bounds); | 548 *font_, title_color, title_bounds); |
549 #else | 549 #else |
550 int flags = gfx::Canvas::TEXT_ALIGN_LEFT; | |
551 if (base::i18n::IsRTL() && | |
552 base::i18n::GetFirstStrongCharacterDirection(title) != | |
553 base::i18n::LEFT_TO_RIGHT) { | |
554 flags = gfx::Canvas::TEXT_ALIGN_RIGHT; | |
555 } | |
xji
2012/06/29 18:11:24
Since RenderText has both directionality and horiz
| |
550 canvas->DrawStringInt(title, *font_, title_color, | 556 canvas->DrawStringInt(title, *font_, title_color, |
551 title_bounds.x(), title_bounds.y(), | 557 title_bounds.x(), title_bounds.y(), |
552 title_bounds.width(), title_bounds.height()); | 558 title_bounds.width(), title_bounds.height(), flags); |
553 #endif | 559 #endif |
554 } | 560 } |
555 | 561 |
556 void BaseTab::AnimationProgressed(const ui::Animation* animation) { | 562 void BaseTab::AnimationProgressed(const ui::Animation* animation) { |
557 // Ignore if the pulse animation is being performed on active tab because | 563 // Ignore if the pulse animation is being performed on active tab because |
558 // it repaints the same image. See |Tab::PaintTabBackground()|. | 564 // it repaints the same image. See |Tab::PaintTabBackground()|. |
559 if (animation == pulse_animation_.get() && IsActive()) | 565 if (animation == pulse_animation_.get() && IsActive()) |
560 return; | 566 return; |
561 SchedulePaint(); | 567 SchedulePaint(); |
562 } | 568 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
638 // static | 644 // static |
639 void BaseTab::InitResources() { | 645 void BaseTab::InitResources() { |
640 static bool initialized = false; | 646 static bool initialized = false; |
641 if (!initialized) { | 647 if (!initialized) { |
642 initialized = true; | 648 initialized = true; |
643 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 649 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
644 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont)); | 650 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont)); |
645 font_height_ = font_->GetHeight(); | 651 font_height_ = font_->GetHeight(); |
646 } | 652 } |
647 } | 653 } |
OLD | NEW |