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