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

Side by Side Diff: chrome/browser/ui/views/status_bubble_views.cc

Issue 2697663002: Clean up naming of paint-related identifiers (Closed)
Patch Set: Rebase Created 3 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 (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/status_bubble_views.h" 5 #include "chrome/browser/ui/views/status_bubble_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "cc/paint/paint_flags.h" 18 #include "cc/paint/paint_flags.h"
19 #include "chrome/browser/themes/theme_properties.h" 19 #include "chrome/browser/themes/theme_properties.h"
20 #include "components/url_formatter/elide_url.h" 20 #include "components/url_formatter/elide_url.h"
21 #include "components/url_formatter/url_formatter.h" 21 #include "components/url_formatter/url_formatter.h"
22 #include "services/service_manager/runner/common/client_util.h" 22 #include "services/service_manager/runner/common/client_util.h"
23 #include "third_party/skia/include/core/SkPaint.h"
24 #include "third_party/skia/include/core/SkPath.h" 23 #include "third_party/skia/include/core/SkPath.h"
25 #include "third_party/skia/include/pathops/SkPathOps.h" 24 #include "third_party/skia/include/pathops/SkPathOps.h"
26 #include "ui/base/theme_provider.h" 25 #include "ui/base/theme_provider.h"
27 #include "ui/display/display.h" 26 #include "ui/display/display.h"
28 #include "ui/display/screen.h" 27 #include "ui/display/screen.h"
29 #include "ui/gfx/animation/animation_delegate.h" 28 #include "ui/gfx/animation/animation_delegate.h"
30 #include "ui/gfx/animation/linear_animation.h" 29 #include "ui/gfx/animation/linear_animation.h"
31 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
32 #include "ui/gfx/font_list.h" 31 #include "ui/gfx/font_list.h"
33 #include "ui/gfx/geometry/point.h" 32 #include "ui/gfx/geometry/point.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // further and further outside the window as the scale increases. 449 // further and further outside the window as the scale increases.
451 const int inset = shadow_thickness_pixels - 1; 450 const int inset = shadow_thickness_pixels - 1;
452 bubble_rect.Inset(style_ == STYLE_STANDARD_RIGHT ? 0 : inset, 0, 451 bubble_rect.Inset(style_ == STYLE_STANDARD_RIGHT ? 0 : inset, 0,
453 style_ == STYLE_STANDARD_RIGHT ? inset : 0, inset); 452 style_ == STYLE_STANDARD_RIGHT ? inset : 0, inset);
454 // Align to pixel centers now that the layout is correct. 453 // Align to pixel centers now that the layout is correct.
455 bubble_rect.Inset(0.5, 0.5); 454 bubble_rect.Inset(0.5, 0.5);
456 455
457 SkPath path; 456 SkPath path;
458 path.addRoundRect(gfx::RectFToSkRect(bubble_rect), rad); 457 path.addRoundRect(gfx::RectFToSkRect(bubble_rect), rad);
459 458
460 cc::PaintFlags paint; 459 cc::PaintFlags flags;
461 paint.setStyle(cc::PaintFlags::kStroke_Style); 460 flags.setStyle(cc::PaintFlags::kStroke_Style);
462 paint.setStrokeWidth(1); 461 flags.setStrokeWidth(1);
463 paint.setAntiAlias(true); 462 flags.setAntiAlias(true);
464 463
465 SkPath stroke_path; 464 SkPath stroke_path;
466 paint.getFillPath(path, &stroke_path); 465 flags.getFillPath(path, &stroke_path);
467 466
468 // Get the fill path by subtracting the shadow so they align neatly. 467 // Get the fill path by subtracting the shadow so they align neatly.
469 SkPath fill_path; 468 SkPath fill_path;
470 Op(path, stroke_path, kDifference_SkPathOp, &fill_path); 469 Op(path, stroke_path, kDifference_SkPathOp, &fill_path);
471 paint.setStyle(cc::PaintFlags::kFill_Style); 470 flags.setStyle(cc::PaintFlags::kFill_Style);
472 const SkColor bubble_color = 471 const SkColor bubble_color =
473 theme_provider_->GetColor(ThemeProperties::COLOR_TOOLBAR); 472 theme_provider_->GetColor(ThemeProperties::COLOR_TOOLBAR);
474 paint.setColor(bubble_color); 473 flags.setColor(bubble_color);
475 canvas->sk_canvas()->drawPath(fill_path, paint); 474 canvas->sk_canvas()->drawPath(fill_path, flags);
476 475
477 paint.setColor(kShadowColor); 476 flags.setColor(kShadowColor);
478 canvas->sk_canvas()->drawPath(stroke_path, paint); 477 canvas->sk_canvas()->drawPath(stroke_path, flags);
479 478
480 canvas->Restore(); 479 canvas->Restore();
481 480
482 // Compute text bounds. 481 // Compute text bounds.
483 gfx::Rect text_rect(kTextPositionX, 0, 482 gfx::Rect text_rect(kTextPositionX, 0,
484 popup_size_.width() - kTextHorizPadding, 483 popup_size_.width() - kTextHorizPadding,
485 popup_size_.height()); 484 popup_size_.height());
486 text_rect.Inset(kShadowThickness, kShadowThickness); 485 text_rect.Inset(kShadowThickness, kShadowThickness);
487 // Make sure the text is aligned to the right on RTL UIs. 486 // Make sure the text is aligned to the right on RTL UIs.
488 text_rect.set_x(GetMirroredXForRect(text_rect)); 487 text_rect.set_x(GetMirroredXForRect(text_rect));
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 void StatusBubbleViews::SetBubbleWidth(int width) { 951 void StatusBubbleViews::SetBubbleWidth(int width) {
953 size_.set_width(width); 952 size_.set_width(width);
954 SetBounds(original_position_.x(), original_position_.y(), 953 SetBounds(original_position_.x(), original_position_.y(),
955 size_.width(), size_.height()); 954 size_.width(), size_.height());
956 } 955 }
957 956
958 void StatusBubbleViews::CancelExpandTimer() { 957 void StatusBubbleViews::CancelExpandTimer() {
959 if (expand_timer_factory_.HasWeakPtrs()) 958 if (expand_timer_factory_.HasWeakPtrs())
960 expand_timer_factory_.InvalidateWeakPtrs(); 959 expand_timer_factory_.InvalidateWeakPtrs();
961 } 960 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698