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

Unified Diff: ui/views/controls/label.cc

Issue 9837059: Cleanup for views::Label: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
===================================================================
--- ui/views/controls/label.cc (revision 128075)
+++ ui/views/controls/label.cc (working copy)
@@ -54,29 +54,21 @@
void Label::SetText(const string16& text) {
text_ = text;
- url_set_ = false;
+ url_ = GURL();
text_size_valid_ = false;
PreferredSizeChanged();
SchedulePaint();
}
-const string16 Label::GetText() const {
- return url_set_ ? UTF8ToUTF16(url_.spec()) : text_;
-}
-
void Label::SetURL(const GURL& url) {
+ DCHECK(url.is_valid());
url_ = url;
text_ = UTF8ToUTF16(url_.spec());
- url_set_ = true;
text_size_valid_ = false;
PreferredSizeChanged();
SchedulePaint();
}
-const GURL Label::GetURL() const {
- return url_set_ ? url_ : GURL(UTF16ToUTF8(text_));
-}
-
void Label::SetAutoColorReadabilityEnabled(bool enabled) {
auto_color_readability_ = enabled;
RecalculateColors();
@@ -354,7 +346,6 @@
contains_mouse_ = false;
font_ = font;
text_size_valid_ = false;
- url_set_ = false;
requested_enabled_color_ = kDefaultEnabledColor;
requested_disabled_color_ = kDefaultDisabledColor;
background_color_ = kDefaultBackgroundColor;
@@ -434,7 +425,7 @@
if (directionality_mode_ == AUTO_DETECT_DIRECTIONALITY) {
base::i18n::TextDirection direction =
- base::i18n::GetFirstStrongCharacterDirection(GetText());
+ base::i18n::GetFirstStrongCharacterDirection(text_);
if (direction == base::i18n::RIGHT_TO_LEFT)
flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
else
@@ -482,7 +473,7 @@
int* flags) const {
DCHECK(paint_text && text_bounds && flags);
- if (url_set_) {
+ if (!url_.is_empty()) {
// TODO(jungshik) : Figure out how to get 'intl.accept_languages'
// preference and use it when calling ElideUrl.
*paint_text =
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698