Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: chrome/browser/ui/views/frame/browser_header_painter_ash.cc

Issue 2550593002: Update WM shadows for MD. (Closed)
Patch Set: fix border for small windows Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/frame/default_header_painter.cc ('k') | ui/gfx/image/image_skia_operations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « ash/common/frame/default_header_painter.cc ('k') | ui/gfx/image/image_skia_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698