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

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

Issue 1764003002: Remove COLOR_STATUS_BAR_TEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('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 (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"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 canvas->sk_canvas()->drawRRect(rrect, shadow_paint); 413 canvas->sk_canvas()->drawRRect(rrect, shadow_paint);
414 414
415 const int shadow_size = 2 * kShadowThickness; 415 const int shadow_size = 2 * kShadowThickness;
416 // Draw the bubble. 416 // Draw the bubble.
417 rect.SetRect(SkIntToScalar(kShadowThickness), SkIntToScalar(kShadowThickness), 417 rect.SetRect(SkIntToScalar(kShadowThickness), SkIntToScalar(kShadowThickness),
418 SkIntToScalar(width - shadow_size), 418 SkIntToScalar(width - shadow_size),
419 SkIntToScalar(height - shadow_size)); 419 SkIntToScalar(height - shadow_size));
420 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); 420 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad);
421 canvas->sk_canvas()->drawRRect(rrect, paint); 421 canvas->sk_canvas()->drawRRect(rrect, paint);
422 422
423 // Draw highlight text and then the text body. In order to make sure the text 423 // Compute text bounds.
424 // is aligned to the right on RTL UIs, we mirror the text bounds if the
425 // locale is RTL.
426 const gfx::FontList font_list; 424 const gfx::FontList font_list;
427 int text_width = 425 int text_width =
428 std::min(gfx::GetStringWidth(text_, font_list), 426 std::min(gfx::GetStringWidth(text_, font_list),
429 width - shadow_size - kTextPositionX - kTextHorizPadding); 427 width - shadow_size - kTextPositionX - kTextHorizPadding);
430 int text_height = height - shadow_size; 428 int text_height = height - shadow_size;
431 gfx::Rect body_bounds(kShadowThickness + kTextPositionX, 429 gfx::Rect text_bounds(kShadowThickness + kTextPositionX,
432 kShadowThickness, 430 kShadowThickness,
433 std::max(0, text_width), 431 std::max(0, text_width),
434 std::max(0, text_height)); 432 std::max(0, text_height));
435 body_bounds.set_x(GetMirroredXForRect(body_bounds)); 433 // Make sure the text is aligned to the right on RTL UIs.
434 text_bounds.set_x(GetMirroredXForRect(text_bounds));
435
436 // Text color is the foreground tab text color at 50% alpha.
436 SkColor text_color = 437 SkColor text_color =
437 theme_provider_->GetColor(ThemeProperties::COLOR_STATUS_BAR_TEXT); 438 theme_provider_->GetColor(ThemeProperties::COLOR_TAB_TEXT);
Evan Stade 2016/03/04 04:22:16 I tried this out on GTK theme mode and yea, it loo
Peter Kasting 2016/03/04 05:53:46 We use this intentionally because we're trying to
438 canvas->DrawStringRect(text_, font_list, text_color, body_bounds); 439 canvas->DrawStringRect(text_, font_list,
440 SkColorSetA(text_color, SkColorGetA(text_color) / 2),
441 text_bounds);
439 } 442 }
440 443
441 444
442 // StatusBubbleViews::StatusViewAnimation -------------------------------------- 445 // StatusBubbleViews::StatusViewAnimation --------------------------------------
443 446
444 StatusBubbleViews::StatusViewAnimation::StatusViewAnimation( 447 StatusBubbleViews::StatusViewAnimation::StatusViewAnimation(
445 StatusView* status_view, 448 StatusView* status_view,
446 double opacity_start, 449 double opacity_start,
447 double opacity_end) 450 double opacity_end)
448 : gfx::LinearAnimation(kFramerate, this), 451 : gfx::LinearAnimation(kFramerate, this),
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 void StatusBubbleViews::SetBubbleWidth(int width) { 889 void StatusBubbleViews::SetBubbleWidth(int width) {
887 size_.set_width(width); 890 size_.set_width(width);
888 SetBounds(original_position_.x(), original_position_.y(), 891 SetBounds(original_position_.x(), original_position_.y(),
889 size_.width(), size_.height()); 892 size_.width(), size_.height());
890 } 893 }
891 894
892 void StatusBubbleViews::CancelExpandTimer() { 895 void StatusBubbleViews::CancelExpandTimer() {
893 if (expand_timer_factory_.HasWeakPtrs()) 896 if (expand_timer_factory_.HasWeakPtrs())
894 expand_timer_factory_.InvalidateWeakPtrs(); 897 expand_timer_factory_.InvalidateWeakPtrs();
895 } 898 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698