| 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/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | 430 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 431 paint.setStyle(SkPaint::kFill_Style); | 431 paint.setStyle(SkPaint::kFill_Style); |
| 432 canvas.DrawRect(gfx::Rect(0, 0, width, height), paint); | 432 canvas.DrawRect(gfx::Rect(0, 0, width, height), paint); |
| 433 } | 433 } |
| 434 | 434 |
| 435 // White highlight on hover. | 435 // White highlight on hover. |
| 436 if (state == views::CustomButton::BS_HOT) | 436 if (state == views::CustomButton::BS_HOT) |
| 437 canvas.FillRect(gfx::Rect(size()), SkColorSetARGB(64, 255, 255, 255)); | 437 canvas.FillRect(gfx::Rect(size()), SkColorSetARGB(64, 255, 255, 255)); |
| 438 | 438 |
| 439 return gfx::ImageSkiaOperations::CreateMaskedImage( | 439 return gfx::ImageSkiaOperations::CreateMaskedImage( |
| 440 gfx::ImageSkia(canvas.ExtractImageSkiaRep()), *mask); | 440 gfx::ImageSkia(canvas.ExtractImageRep()), *mask); |
| 441 } | 441 } |
| 442 | 442 |
| 443 gfx::ImageSkia NewTabButton::GetImageForState( | 443 gfx::ImageSkia NewTabButton::GetImageForState( |
| 444 views::CustomButton::ButtonState state, | 444 views::CustomButton::ButtonState state, |
| 445 ui::ScaleFactor scale_factor) const { | 445 ui::ScaleFactor scale_factor) const { |
| 446 int overlay_id = 0; | 446 int overlay_id = 0; |
| 447 // The new tab button field trial will get created in variations_service.cc | 447 // The new tab button field trial will get created in variations_service.cc |
| 448 // through the variations server. | 448 // through the variations server. |
| 449 if (base::FieldTrialList::FindFullName(kNewTabButtonFieldTrialName) == | 449 if (base::FieldTrialList::FindFullName(kNewTabButtonFieldTrialName) == |
| 450 kNewTabButtonFieldTrialPlusGroupName) { | 450 kNewTabButtonFieldTrialPlusGroupName) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 461 canvas.DrawImageInt(GetBackgroundImage(state, scale_factor), 0, 0); | 461 canvas.DrawImageInt(GetBackgroundImage(state, scale_factor), 0, 0); |
| 462 | 462 |
| 463 // Draw the button border with a slight alpha. | 463 // Draw the button border with a slight alpha. |
| 464 const int kNativeFrameOverlayAlpha = 178; | 464 const int kNativeFrameOverlayAlpha = 178; |
| 465 const int kOpaqueFrameOverlayAlpha = 230; | 465 const int kOpaqueFrameOverlayAlpha = 230; |
| 466 canvas.SaveLayerAlpha(ShouldUseNativeFrame() ? | 466 canvas.SaveLayerAlpha(ShouldUseNativeFrame() ? |
| 467 kNativeFrameOverlayAlpha : kOpaqueFrameOverlayAlpha); | 467 kNativeFrameOverlayAlpha : kOpaqueFrameOverlayAlpha); |
| 468 canvas.DrawImageInt(*overlay, 0, 0); | 468 canvas.DrawImageInt(*overlay, 0, 0); |
| 469 canvas.Restore(); | 469 canvas.Restore(); |
| 470 | 470 |
| 471 return gfx::ImageSkia(canvas.ExtractImageSkiaRep()); | 471 return gfx::ImageSkia(canvas.ExtractImageRep()); |
| 472 } | 472 } |
| 473 | 473 |
| 474 gfx::ImageSkia NewTabButton::GetImage(ui::ScaleFactor scale_factor) const { | 474 gfx::ImageSkia NewTabButton::GetImage(ui::ScaleFactor scale_factor) const { |
| 475 if (!hover_animation_->is_animating()) | 475 if (!hover_animation_->is_animating()) |
| 476 return GetImageForState(state(), scale_factor); | 476 return GetImageForState(state(), scale_factor); |
| 477 return gfx::ImageSkiaOperations::CreateBlendedImage( | 477 return gfx::ImageSkiaOperations::CreateBlendedImage( |
| 478 GetImageForState(views::CustomButton::BS_NORMAL, scale_factor), | 478 GetImageForState(views::CustomButton::BS_NORMAL, scale_factor), |
| 479 GetImageForState(views::CustomButton::BS_HOT, scale_factor), | 479 GetImageForState(views::CustomButton::BS_HOT, scale_factor), |
| 480 hover_animation_->GetCurrentValue()); | 480 hover_animation_->GetCurrentValue()); |
| 481 } | 481 } |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 | 2342 |
| 2343 int mini_tab_count = GetMiniTabCount(); | 2343 int mini_tab_count = GetMiniTabCount(); |
| 2344 int normal_count = tab_count() - mini_tab_count; | 2344 int normal_count = tab_count() - mini_tab_count; |
| 2345 if (normal_count == 0 || normal_count == mini_tab_count) | 2345 if (normal_count == 0 || normal_count == mini_tab_count) |
| 2346 return false; | 2346 return false; |
| 2347 int x = GetStartXForNormalTabs(); | 2347 int x = GetStartXForNormalTabs(); |
| 2348 int available_width = width() - x - new_tab_button_width(); | 2348 int available_width = width() - x - new_tab_button_width(); |
| 2349 return (Tab::GetTouchWidth() * normal_count + | 2349 return (Tab::GetTouchWidth() * normal_count + |
| 2350 tab_h_offset() * (normal_count - 1)) > available_width; | 2350 tab_h_offset() * (normal_count - 1)) > available_width; |
| 2351 } | 2351 } |
| OLD | NEW |