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

Side by Side Diff: chrome/browser/ui/views/location_bar/add_to_app_launcher_view.cc

Issue 354963003: Move gfx::ElideText functionality to RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase. Created 6 years, 5 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 | Annotate | Revision Log
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/location_bar/add_to_app_launcher_view.h" 5 #include "chrome/browser/ui/views/location_bar/add_to_app_launcher_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2); 79 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2);
80 // Tricky bit: We alpha blend an opaque version of |background_image_color| 80 // Tricky bit: We alpha blend an opaque version of |background_image_color|
81 // against |parent_background_color| using the original image grid color's 81 // against |parent_background_color| using the original image grid color's
82 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged 82 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged
83 // even if |a| is a color with non-255 alpha. 83 // even if |a| is a color with non-255 alpha.
84 text_label_->SetBackgroundColor( 84 text_label_->SetBackgroundColor(
85 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), 85 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255),
86 parent_background_color, 86 parent_background_color,
87 SkColorGetA(background_image_color))); 87 SkColorGetA(background_image_color)));
88 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 88 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
89 text_label_->SetElideBehavior(gfx::TRUNCATE); 89 text_label_->SetElideBehavior(gfx::NO_ELIDE);
90 text_label_->SetText(base::UTF8ToUTF16( 90 text_label_->SetText(base::UTF8ToUTF16(
91 l10n_util::GetStringUTF8(IDS_ADD_TO_APP_LIST_NOTIFICATION_TEXT))); 91 l10n_util::GetStringUTF8(IDS_ADD_TO_APP_LIST_NOTIFICATION_TEXT)));
92 AddChildView(text_label_); 92 AddChildView(text_label_);
93 93
94 slide_animator_.SetSlideDuration(kAnimationDurationMS); 94 slide_animator_.SetSlideDuration(kAnimationDurationMS);
95 slide_animator_.SetTweenType(gfx::Tween::LINEAR); 95 slide_animator_.SetTweenType(gfx::Tween::LINEAR);
96 } 96 }
97 97
98 AddToAppLauncherView::~AddToAppLauncherView() { 98 AddToAppLauncherView::~AddToAppLauncherView() {
99 } 99 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 icon_->bounds().right() + LocationBarView::kItemPadding, 168 icon_->bounds().right() + LocationBarView::kItemPadding,
169 0, 169 0,
170 std::max(width() - GetTotalSpacingWhileAnimating() - icon_width, 0), 170 std::max(width() - GetTotalSpacingWhileAnimating() - icon_width, 0),
171 height()); 171 height());
172 } 172 }
173 173
174 void AddToAppLauncherView::OnPaintBackground(gfx::Canvas* canvas) { 174 void AddToAppLauncherView::OnPaintBackground(gfx::Canvas* canvas) {
175 if (slide_animator_.is_animating()) 175 if (slide_animator_.is_animating())
176 background_painter_->Paint(canvas, size()); 176 background_painter_->Paint(canvas, size());
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698