| 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.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" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/view_ids.h" | 13 #include "chrome/browser/ui/view_ids.h" |
| 14 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 14 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "grit/app_resources.h" | 17 #include "grit/app_resources.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 19 #include "ui/base/animation/slide_animation.h" | 20 #include "ui/base/animation/slide_animation.h" |
| 20 #include "ui/base/animation/throb_animation.h" | 21 #include "ui/base/animation/throb_animation.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/base/theme_provider.h" | 24 #include "ui/base/theme_provider.h" |
| 24 #include "ui/gfx/canvas_skia.h" | 25 #include "ui/gfx/canvas_skia.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 canvas->Restore(); | 431 canvas->Restore(); |
| 431 } | 432 } |
| 432 } | 433 } |
| 433 | 434 |
| 434 void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) { | 435 void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) { |
| 435 // Paint the Title. | 436 // Paint the Title. |
| 436 string16 title = data().title; | 437 string16 title = data().title; |
| 437 if (title.empty()) { | 438 if (title.empty()) { |
| 438 title = data().loading ? | 439 title = data().loading ? |
| 439 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : | 440 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : |
| 440 TabContents::GetDefaultTitle(); | 441 TabContentsWrapper::GetDefaultTitle(); |
| 441 } else { | 442 } else { |
| 442 Browser::FormatTitleForDisplay(&title); | 443 Browser::FormatTitleForDisplay(&title); |
| 443 } | 444 } |
| 444 const gfx::Rect& title_bounds = GetTitleBounds(); | 445 const gfx::Rect& title_bounds = GetTitleBounds(); |
| 445 canvas->DrawStringInt(title, *font_, title_color, | 446 canvas->DrawStringInt(title, *font_, title_color, |
| 446 title_bounds.x(), title_bounds.y(), | 447 title_bounds.x(), title_bounds.y(), |
| 447 title_bounds.width(), title_bounds.height()); | 448 title_bounds.width(), title_bounds.height()); |
| 448 } | 449 } |
| 449 | 450 |
| 450 void BaseTab::AnimationProgressed(const ui::Animation* animation) { | 451 void BaseTab::AnimationProgressed(const ui::Animation* animation) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // static | 518 // static |
| 518 void BaseTab::InitResources() { | 519 void BaseTab::InitResources() { |
| 519 static bool initialized = false; | 520 static bool initialized = false; |
| 520 if (!initialized) { | 521 if (!initialized) { |
| 521 initialized = true; | 522 initialized = true; |
| 522 font_ = new gfx::Font( | 523 font_ = new gfx::Font( |
| 523 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 524 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); |
| 524 font_height_ = font_->GetHeight(); | 525 font_height_ = font_->GetHeight(); |
| 525 } | 526 } |
| 526 } | 527 } |
| OLD | NEW |