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

Side by Side Diff: ash/frame/default_header_painter.cc

Issue 916293002: Remove ash default frame highlighting for custom colored frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment Created 5 years, 10 months 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/frame/default_header_painter.h ('k') | no next file » | 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 "ash/frame/default_header_painter.h" 5 #include "ash/frame/default_header_painter.h"
6 6
7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
8 #include "ash/frame/header_painter_util.h" 8 #include "ash/frame/header_painter_util.h"
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" // DCHECK 10 #include "base/logging.h" // DCHECK
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int corner_radius = (frame_->IsMaximized() || frame_->IsFullscreen()) ? 163 int corner_radius = (frame_->IsMaximized() || frame_->IsFullscreen()) ?
164 0 : HeaderPainterUtil::GetTopCornerRadiusWhenRestored(); 164 0 : HeaderPainterUtil::GetTopCornerRadiusWhenRestored();
165 165
166 SkPaint paint; 166 SkPaint paint;
167 int active_alpha = activation_animation_->CurrentValueBetween(0, 255); 167 int active_alpha = activation_animation_->CurrentValueBetween(0, 255);
168 paint.setColor(color_utils::AlphaBlend( 168 paint.setColor(color_utils::AlphaBlend(
169 active_frame_color_, GetInactiveFrameColor(), active_alpha)); 169 active_frame_color_, GetInactiveFrameColor(), active_alpha));
170 170
171 TileRoundRect(canvas, paint, GetLocalBounds(), corner_radius); 171 TileRoundRect(canvas, paint, GetLocalBounds(), corner_radius);
172 172
173 if (!frame_->IsMaximized() && 173 if (!frame_->IsMaximized() && !frame_->IsFullscreen() &&
174 !frame_->IsFullscreen() && 174 mode_ == MODE_INACTIVE && !UsesCustomFrameColors()) {
175 mode_ == MODE_INACTIVE) {
176 PaintHighlightForInactiveRestoredWindow(canvas); 175 PaintHighlightForInactiveRestoredWindow(canvas);
177 } 176 }
178 if (frame_->widget_delegate() && 177 if (frame_->widget_delegate() &&
179 frame_->widget_delegate()->ShouldShowWindowTitle()) { 178 frame_->widget_delegate()->ShouldShowWindowTitle()) {
180 PaintTitleBar(canvas); 179 PaintTitleBar(canvas);
181 } 180 }
182 PaintHeaderContentSeparator(canvas); 181 if (!UsesCustomFrameColors())
182 PaintHeaderContentSeparator(canvas);
183 } 183 }
184 184
185 void DefaultHeaderPainter::LayoutHeader() { 185 void DefaultHeaderPainter::LayoutHeader() {
186 UpdateSizeButtonImages(); 186 UpdateSizeButtonImages();
187 caption_button_container_->Layout(); 187 caption_button_container_->Layout();
188 188
189 gfx::Size caption_button_container_size = 189 gfx::Size caption_button_container_size =
190 caption_button_container_->GetPreferredSize(); 190 caption_button_container_->GetPreferredSize();
191 caption_button_container_->SetBounds( 191 caption_button_container_->SetBounds(
192 view_->width() - caption_button_container_size.width(), 192 view_->width() - caption_button_container_size.width(),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const { 334 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
335 return gfx::Rect(view_->width(), height_); 335 return gfx::Rect(view_->width(), height_);
336 } 336 }
337 337
338 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const { 338 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const {
339 return HeaderPainterUtil::GetTitleBounds( 339 return HeaderPainterUtil::GetTitleBounds(
340 left_header_view_, caption_button_container_, GetTitleFontList()); 340 left_header_view_, caption_button_container_, GetTitleFontList());
341 } 341 }
342 342
343 bool DefaultHeaderPainter::UsesCustomFrameColors() const {
344 return active_frame_color_ != kDefaultFrameColor ||
345 inactive_frame_color_ != kDefaultFrameColor;
346 }
347
343 SkColor DefaultHeaderPainter::GetInactiveFrameColor() const { 348 SkColor DefaultHeaderPainter::GetInactiveFrameColor() const {
344 SkColor color = inactive_frame_color_; 349 SkColor color = inactive_frame_color_;
345 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) { 350 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) {
346 color = SkColorSetARGB(kInactiveFrameAlpha, 351 color = SkColorSetARGB(kInactiveFrameAlpha,
347 SkColorGetR(color), 352 SkColorGetR(color),
348 SkColorGetG(color), 353 SkColorGetG(color),
349 SkColorGetB(color)); 354 SkColorGetB(color));
350 } 355 }
351 return color; 356 return color;
352 } 357 }
353 358
354 } // namespace ash 359 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/default_header_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698