| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/browser_header_painter_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_layout_constants.h" | 7 #include "ash/common/ash_layout_constants.h" |
| 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 9 #include "ash/common/frame/header_painter_util.h" | 9 #include "ash/common/frame/header_painter_util.h" |
| 10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 void BrowserHeaderPainterAsh::PaintFrameImages(gfx::Canvas* canvas, | 250 void BrowserHeaderPainterAsh::PaintFrameImages(gfx::Canvas* canvas, |
| 251 bool active) { | 251 bool active) { |
| 252 int alpha = activation_animation_->CurrentValueBetween(0, 0xFF); | 252 int alpha = activation_animation_->CurrentValueBetween(0, 0xFF); |
| 253 if (!active) | 253 if (!active) |
| 254 alpha = 0xFF - alpha; | 254 alpha = 0xFF - alpha; |
| 255 | 255 |
| 256 if (alpha == 0) | 256 if (alpha == 0) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 int corner_radius = | 259 bool round_corners = !frame_->IsMaximized() && !frame_->IsFullscreen(); |
| 260 (frame_->IsMaximized() || frame_->IsFullscreen()) | |
| 261 ? 0 | |
| 262 : ash::HeaderPainterUtil::GetTopCornerRadiusWhenRestored(); | |
| 263 | |
| 264 gfx::ImageSkia frame_image = view_->GetFrameImage(active); | 260 gfx::ImageSkia frame_image = view_->GetFrameImage(active); |
| 265 gfx::ImageSkia frame_overlay_image = view_->GetFrameOverlayImage(active); | 261 gfx::ImageSkia frame_overlay_image = view_->GetFrameOverlayImage(active); |
| 266 | 262 |
| 267 SkPaint paint; | 263 SkPaint paint; |
| 268 paint.setBlendMode(SkBlendMode::kPlus); | 264 paint.setBlendMode(SkBlendMode::kPlus); |
| 269 paint.setAlpha(alpha); | 265 paint.setAlpha(alpha); |
| 270 paint.setColor(SkColorSetA(view_->GetFrameColor(active), alpha)); | 266 paint.setColor(SkColorSetA(view_->GetFrameColor(active), alpha)); |
| 267 paint.setAntiAlias(round_corners); |
| 271 PaintFrameImagesInRoundRect( | 268 PaintFrameImagesInRoundRect( |
| 272 canvas, frame_image, frame_overlay_image, paint, GetPaintedBounds(), | 269 canvas, frame_image, frame_overlay_image, paint, GetPaintedBounds(), |
| 273 corner_radius, ash::HeaderPainterUtil::GetThemeBackgroundXInset()); | 270 round_corners ? ash::HeaderPainterUtil::GetTopCornerRadiusWhenRestored() |
| 271 : 0, |
| 272 ash::HeaderPainterUtil::GetThemeBackgroundXInset()); |
| 274 } | 273 } |
| 275 | 274 |
| 276 void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) { | 275 void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) { |
| 277 // The window icon is painted by its own views::View. | 276 // The window icon is painted by its own views::View. |
| 278 gfx::Rect title_bounds = GetTitleBounds(); | 277 gfx::Rect title_bounds = GetTitleBounds(); |
| 279 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); | 278 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); |
| 280 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), | 279 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), |
| 281 BrowserFrame::GetTitleFontList(), | 280 BrowserFrame::GetTitleFontList(), |
| 282 is_incognito_ ? kIncognitoWindowTitleTextColor | 281 is_incognito_ ? kIncognitoWindowTitleTextColor |
| 283 : kNormalWindowTitleTextColor, | 282 : kNormalWindowTitleTextColor, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 313 } | 312 } |
| 314 | 313 |
| 315 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 314 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
| 316 return gfx::Rect(view_->width(), painted_height_); | 315 return gfx::Rect(view_->width(), painted_height_); |
| 317 } | 316 } |
| 318 | 317 |
| 319 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 318 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
| 320 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 319 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
| 321 caption_button_container_, BrowserFrame::GetTitleFontList()); | 320 caption_button_container_, BrowserFrame::GetTitleFontList()); |
| 322 } | 321 } |
| OLD | NEW |