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

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: 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
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void DefaultHeaderPainter::AnimationProgressed( 235 void DefaultHeaderPainter::AnimationProgressed(
236 const gfx::Animation* animation) { 236 const gfx::Animation* animation) {
237 view_->SchedulePaintInRect(GetLocalBounds()); 237 view_->SchedulePaintInRect(GetLocalBounds());
238 } 238 }
239 239
240 /////////////////////////////////////////////////////////////////////////////// 240 ///////////////////////////////////////////////////////////////////////////////
241 // DefaultHeaderPainter, private: 241 // DefaultHeaderPainter, private:
242 242
243 void DefaultHeaderPainter::PaintHighlightForInactiveRestoredWindow( 243 void DefaultHeaderPainter::PaintHighlightForInactiveRestoredWindow(
244 gfx::Canvas* canvas) { 244 gfx::Canvas* canvas) {
245 if (HasCustomFrameColors())
pkotwicz 2015/02/12 02:04:52 I think it would make more sense to add this logic
benwells 2015/02/12 02:36:10 Done.
246 return;
247
245 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 248 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
246 gfx::ImageSkia top_edge = *rb.GetImageSkiaNamed( 249 gfx::ImageSkia top_edge = *rb.GetImageSkiaNamed(
247 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_TOP); 250 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_TOP);
248 gfx::ImageSkia left_edge = *rb.GetImageSkiaNamed( 251 gfx::ImageSkia left_edge = *rb.GetImageSkiaNamed(
249 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_LEFT); 252 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_LEFT);
250 gfx::ImageSkia right_edge = *rb.GetImageSkiaNamed( 253 gfx::ImageSkia right_edge = *rb.GetImageSkiaNamed(
251 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_RIGHT); 254 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_RIGHT);
252 gfx::ImageSkia bottom_edge = *rb.GetImageSkiaNamed( 255 gfx::ImageSkia bottom_edge = *rb.GetImageSkiaNamed(
253 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_BOTTOM); 256 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_BOTTOM);
254 257
(...skipping 24 matching lines...) Expand all
279 gfx::Rect title_bounds = GetTitleBounds(); 282 gfx::Rect title_bounds = GetTitleBounds();
280 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); 283 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds));
281 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), 284 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(),
282 GetTitleFontList(), 285 GetTitleFontList(),
283 kTitleTextColor, 286 kTitleTextColor,
284 title_bounds, 287 title_bounds,
285 gfx::Canvas::NO_SUBPIXEL_RENDERING); 288 gfx::Canvas::NO_SUBPIXEL_RENDERING);
286 } 289 }
287 290
288 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) { 291 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
292 if (HasCustomFrameColors())
293 return;
294
289 SkColor color = (mode_ == MODE_ACTIVE) ? 295 SkColor color = (mode_ == MODE_ACTIVE) ?
290 kHeaderContentSeparatorColor : 296 kHeaderContentSeparatorColor :
291 kHeaderContentSeparatorInactiveColor; 297 kHeaderContentSeparatorInactiveColor;
292 298
293 SkPaint paint; 299 SkPaint paint;
294 paint.setColor(color); 300 paint.setColor(color);
295 // Draw the line as 1px thick regardless of scale factor. 301 // Draw the line as 1px thick regardless of scale factor.
296 paint.setStrokeWidth(0); 302 paint.setStrokeWidth(0);
297 303
298 float thickness = 1 / canvas->image_scale(); 304 float thickness = 1 / canvas->image_scale();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 339
334 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const { 340 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
335 return gfx::Rect(view_->width(), height_); 341 return gfx::Rect(view_->width(), height_);
336 } 342 }
337 343
338 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const { 344 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const {
339 return HeaderPainterUtil::GetTitleBounds( 345 return HeaderPainterUtil::GetTitleBounds(
340 left_header_view_, caption_button_container_, GetTitleFontList()); 346 left_header_view_, caption_button_container_, GetTitleFontList());
341 } 347 }
342 348
349 bool DefaultHeaderPainter::HasCustomFrameColors() const {
350 return active_frame_color_ != kDefaultFrameColor ||
351 inactive_frame_color_ != kDefaultFrameColor;
352 }
353
343 SkColor DefaultHeaderPainter::GetInactiveFrameColor() const { 354 SkColor DefaultHeaderPainter::GetInactiveFrameColor() const {
344 SkColor color = inactive_frame_color_; 355 SkColor color = inactive_frame_color_;
345 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) { 356 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) {
346 color = SkColorSetARGB(kInactiveFrameAlpha, 357 color = SkColorSetARGB(kInactiveFrameAlpha,
347 SkColorGetR(color), 358 SkColorGetR(color),
348 SkColorGetG(color), 359 SkColorGetG(color),
349 SkColorGetB(color)); 360 SkColorGetB(color));
350 } 361 }
351 return color; 362 return color;
352 } 363 }
353 364
354 } // namespace ash 365 } // namespace ash
OLDNEW
« ash/frame/default_header_painter.h ('K') | « ash/frame/default_header_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698