OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "chrome/browser/views/tabs/tab_renderer.h" | 7 #include "chrome/browser/views/tabs/tab_renderer.h" |
8 | 8 |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); | 500 hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); |
501 hover_animation_->Show(); | 501 hover_animation_->Show(); |
502 } | 502 } |
503 | 503 |
504 void TabRenderer::OnMouseExited(const views::MouseEvent& e) { | 504 void TabRenderer::OnMouseExited(const views::MouseEvent& e) { |
505 hover_animation_->SetTweenType(SlideAnimation::EASE_IN); | 505 hover_animation_->SetTweenType(SlideAnimation::EASE_IN); |
506 hover_animation_->Hide(); | 506 hover_animation_->Hide(); |
507 } | 507 } |
508 | 508 |
509 void TabRenderer::ThemeChanged() { | 509 void TabRenderer::ThemeChanged() { |
510 if (GetWidget() && GetWidget()->GetWindow()) { | 510 if (GetWindow()) |
511 LoadTabImages( | 511 LoadTabImages(GetWindow()->GetNonClientView()->UseNativeFrame()); |
512 GetWidget()->GetWindow()->GetNonClientView()->UseNativeFrame()); | |
513 } | |
514 View::ThemeChanged(); | 512 View::ThemeChanged(); |
515 } | 513 } |
516 | 514 |
517 /////////////////////////////////////////////////////////////////////////////// | 515 /////////////////////////////////////////////////////////////////////////////// |
518 // TabRenderer, AnimationDelegate implementation: | 516 // TabRenderer, AnimationDelegate implementation: |
519 | 517 |
520 void TabRenderer::AnimationProgressed(const Animation* animation) { | 518 void TabRenderer::AnimationProgressed(const Animation* animation) { |
521 SchedulePaint(); | 519 SchedulePaint(); |
522 } | 520 } |
523 | 521 |
(...skipping 14 matching lines...) Expand all Loading... |
538 // as not being selected, so is_drag_clone_ ensures that we always paint | 536 // as not being selected, so is_drag_clone_ ensures that we always paint |
539 // the active representation for the dragged tab. | 537 // the active representation for the dragged tab. |
540 PaintActiveTabBackground(canvas); | 538 PaintActiveTabBackground(canvas); |
541 } else { | 539 } else { |
542 // Draw our hover state. | 540 // Draw our hover state. |
543 Animation* animation = hover_animation_.get(); | 541 Animation* animation = hover_animation_.get(); |
544 if (pulse_animation_->IsAnimating()) | 542 if (pulse_animation_->IsAnimating()) |
545 animation = pulse_animation_.get(); | 543 animation = pulse_animation_.get(); |
546 if (animation->GetCurrentValue() > 0) { | 544 if (animation->GetCurrentValue() > 0) { |
547 PaintHoverTabBackground(canvas, animation->GetCurrentValue() * | 545 PaintHoverTabBackground(canvas, animation->GetCurrentValue() * |
548 (GetWidget()->GetWindow()->GetNonClientView()->UseNativeFrame() ? | 546 (GetWindow()->GetNonClientView()->UseNativeFrame() ? |
549 kHoverOpacityVista : kHoverOpacity)); | 547 kHoverOpacityVista : kHoverOpacity)); |
550 } else { | 548 } else { |
551 PaintInactiveTabBackground(canvas); | 549 PaintInactiveTabBackground(canvas); |
552 } | 550 } |
553 } | 551 } |
554 } | 552 } |
555 | 553 |
556 void TabRenderer::PaintInactiveTabBackground(ChromeCanvas* canvas) { | 554 void TabRenderer::PaintInactiveTabBackground(ChromeCanvas* canvas) { |
557 bool is_otr = data_.off_the_record; | 555 bool is_otr = data_.off_the_record; |
558 canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr.image_l : | 556 canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr.image_l : |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); | 699 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); |
702 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); | 700 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); |
703 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); | 701 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); |
704 } | 702 } |
705 | 703 |
706 tab_inactive.l_width = tab_inactive.image_l->width(); | 704 tab_inactive.l_width = tab_inactive.image_l->width(); |
707 tab_inactive.r_width = tab_inactive.image_r->width(); | 705 tab_inactive.r_width = tab_inactive.image_r->width(); |
708 // tab_[hover,inactive_otr] width are not used and are initialized to 0 | 706 // tab_[hover,inactive_otr] width are not used and are initialized to 0 |
709 // during static initialization. | 707 // during static initialization. |
710 } | 708 } |
OLD | NEW |