| 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()->AsWindow()) | 510 if (GetWidget() && GetWidget()->GetWindow()) { |
| 511 LoadTabImages(GetWidget()->AsWindow()->GetNonClientView()->UseNativeFrame())
; | 511 LoadTabImages( |
| 512 GetWidget()->GetWindow()->GetNonClientView()->UseNativeFrame()); |
| 513 } |
| 512 View::ThemeChanged(); | 514 View::ThemeChanged(); |
| 513 } | 515 } |
| 514 | 516 |
| 515 /////////////////////////////////////////////////////////////////////////////// | 517 /////////////////////////////////////////////////////////////////////////////// |
| 516 // TabRenderer, AnimationDelegate implementation: | 518 // TabRenderer, AnimationDelegate implementation: |
| 517 | 519 |
| 518 void TabRenderer::AnimationProgressed(const Animation* animation) { | 520 void TabRenderer::AnimationProgressed(const Animation* animation) { |
| 519 SchedulePaint(); | 521 SchedulePaint(); |
| 520 } | 522 } |
| 521 | 523 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 536 // as not being selected, so is_drag_clone_ ensures that we always paint | 538 // as not being selected, so is_drag_clone_ ensures that we always paint |
| 537 // the active representation for the dragged tab. | 539 // the active representation for the dragged tab. |
| 538 PaintActiveTabBackground(canvas); | 540 PaintActiveTabBackground(canvas); |
| 539 } else { | 541 } else { |
| 540 // Draw our hover state. | 542 // Draw our hover state. |
| 541 Animation* animation = hover_animation_.get(); | 543 Animation* animation = hover_animation_.get(); |
| 542 if (pulse_animation_->IsAnimating()) | 544 if (pulse_animation_->IsAnimating()) |
| 543 animation = pulse_animation_.get(); | 545 animation = pulse_animation_.get(); |
| 544 if (animation->GetCurrentValue() > 0) { | 546 if (animation->GetCurrentValue() > 0) { |
| 545 PaintHoverTabBackground(canvas, animation->GetCurrentValue() * | 547 PaintHoverTabBackground(canvas, animation->GetCurrentValue() * |
| 546 (GetWidget()->AsWindow()->GetNonClientView()->UseNativeFrame() ? | 548 (GetWidget()->GetWindow()->GetNonClientView()->UseNativeFrame() ? |
| 547 kHoverOpacityVista : kHoverOpacity)); | 549 kHoverOpacityVista : kHoverOpacity)); |
| 548 } else { | 550 } else { |
| 549 PaintInactiveTabBackground(canvas); | 551 PaintInactiveTabBackground(canvas); |
| 550 } | 552 } |
| 551 } | 553 } |
| 552 } | 554 } |
| 553 | 555 |
| 554 void TabRenderer::PaintInactiveTabBackground(ChromeCanvas* canvas) { | 556 void TabRenderer::PaintInactiveTabBackground(ChromeCanvas* canvas) { |
| 555 bool is_otr = data_.off_the_record; | 557 bool is_otr = data_.off_the_record; |
| 556 canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr.image_l : | 558 canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr.image_l : |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); | 701 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); |
| 700 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); | 702 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); |
| 701 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); | 703 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); |
| 702 } | 704 } |
| 703 | 705 |
| 704 tab_inactive.l_width = tab_inactive.image_l->width(); | 706 tab_inactive.l_width = tab_inactive.image_l->width(); |
| 705 tab_inactive.r_width = tab_inactive.image_r->width(); | 707 tab_inactive.r_width = tab_inactive.image_r->width(); |
| 706 // tab_[hover,inactive_otr] width are not used and are initialized to 0 | 708 // tab_[hover,inactive_otr] width are not used and are initialized to 0 |
| 707 // during static initialization. | 709 // during static initialization. |
| 708 } | 710 } |
| OLD | NEW |