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

Side by Side Diff: views/controls/label.cc

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « views/controls/combobox/native_combobox_gtk.h ('k') | views/controls/menu/native_menu_gtk.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/label.h" 5 #include "views/controls/label.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "app/text_elider.h"
12 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/string_split.h" 13 #include "base/string_split.h"
15 #include "base/string_util.h" 14 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
17 #include "gfx/canvas_skia.h" 16 #include "gfx/canvas_skia.h"
18 #include "gfx/color_utils.h" 17 #include "gfx/color_utils.h"
19 #include "gfx/font.h" 18 #include "gfx/font.h"
20 #include "gfx/insets.h" 19 #include "gfx/insets.h"
20 #include "ui/base/text/text_elider.h"
21 #include "views/background.h" 21 #include "views/background.h"
22 22
23 namespace views { 23 namespace views {
24 24
25 // static 25 // static
26 const char Label::kViewClassName[] = "views/Label"; 26 const char Label::kViewClassName[] = "views/Label";
27 SkColor Label::kEnabledColor, Label::kDisabledColor; 27 SkColor Label::kEnabledColor, Label::kDisabledColor;
28 28
29 const int Label::kFocusBorderPadding = 1; 29 const int Label::kFocusBorderPadding = 1;
30 30
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 void Label::CalculateDrawStringParams(std::wstring* paint_text, 422 void Label::CalculateDrawStringParams(std::wstring* paint_text,
423 gfx::Rect* text_bounds, 423 gfx::Rect* text_bounds,
424 int* flags) const { 424 int* flags) const {
425 DCHECK(paint_text && text_bounds && flags); 425 DCHECK(paint_text && text_bounds && flags);
426 426
427 if (url_set_) { 427 if (url_set_) {
428 // TODO(jungshik) : Figure out how to get 'intl.accept_languages' 428 // TODO(jungshik) : Figure out how to get 'intl.accept_languages'
429 // preference and use it when calling ElideUrl. 429 // preference and use it when calling ElideUrl.
430 *paint_text = UTF16ToWideHack( 430 *paint_text = UTF16ToWideHack(
431 gfx::ElideUrl(url_, font_, GetAvailableRect().width(), std::wstring())); 431 ui::ElideUrl(url_, font_, GetAvailableRect().width(), std::wstring()));
432 432
433 // An URLs is always treated as an LTR text and therefore we should 433 // An URLs is always treated as an LTR text and therefore we should
434 // explicitly mark it as such if the locale is RTL so that URLs containing 434 // explicitly mark it as such if the locale is RTL so that URLs containing
435 // Hebrew or Arabic characters are displayed correctly. 435 // Hebrew or Arabic characters are displayed correctly.
436 // 436 //
437 // Note that we don't check the View's UI layout setting in order to 437 // Note that we don't check the View's UI layout setting in order to
438 // determine whether or not to insert the special Unicode formatting 438 // determine whether or not to insert the special Unicode formatting
439 // characters. We use the locale settings because an URL is always treated 439 // characters. We use the locale settings because an URL is always treated
440 // as an LTR string, even if its containing view does not use an RTL UI 440 // as an LTR string, even if its containing view does not use an RTL UI
441 // layout. 441 // layout.
442 *paint_text = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( 442 *paint_text = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
443 WideToUTF16(*paint_text))); 443 WideToUTF16(*paint_text)));
444 } else if (elide_in_middle_) { 444 } else if (elide_in_middle_) {
445 *paint_text = UTF16ToWideHack(gfx::ElideText(text_, 445 *paint_text = UTF16ToWideHack(ui::ElideText(text_,
446 font_, GetAvailableRect().width(), true)); 446 font_, GetAvailableRect().width(), true));
447 } else { 447 } else {
448 *paint_text = UTF16ToWideHack(text_); 448 *paint_text = UTF16ToWideHack(text_);
449 } 449 }
450 450
451 *text_bounds = GetTextBounds(); 451 *text_bounds = GetTextBounds();
452 *flags = ComputeMultiLineFlags(); 452 *flags = ComputeMultiLineFlags();
453 } 453 }
454 454
455 } // namespace views 455 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/combobox/native_combobox_gtk.h ('k') | views/controls/menu/native_menu_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698