OLD | NEW |
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 "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" | 5 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" |
6 | 6 |
7 #include "app/bidi_line_iterator.h" | 7 #include "app/bidi_line_iterator.h" |
8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "app/theme_provider.h" | 11 #include "app/theme_provider.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/i18n/rtl.h" |
13 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 14 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
14 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
15 #include "chrome/browser/bubble_positioner.h" | 16 #include "chrome/browser/bubble_positioner.h" |
16 #include "chrome/browser/views/bubble_border.h" | 17 #include "chrome/browser/views/bubble_border.h" |
17 #include "gfx/color_utils.h" | 18 #include "gfx/color_utils.h" |
18 #include "gfx/insets.h" | 19 #include "gfx/insets.h" |
19 #include "gfx/path.h" | 20 #include "gfx/path.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
22 #include "third_party/skia/include/core/SkShader.h" | 23 #include "third_party/skia/include/core/SkShader.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (force_dim) | 478 if (force_dim) |
478 style |= ACMatchClassification::DIM; | 479 style |= ACMatchClassification::DIM; |
479 | 480 |
480 // We specify RTL directionlity explicitly only if the run is an RTL run | 481 // We specify RTL directionlity explicitly only if the run is an RTL run |
481 // and we can't specify the string directionlaity using an LRE/PDF pair. | 482 // and we can't specify the string directionlaity using an LRE/PDF pair. |
482 // Note that URLs are always displayed using LTR directionality | 483 // Note that URLs are always displayed using LTR directionality |
483 // (regardless of the locale) and therefore they are excluded. | 484 // (regardless of the locale) and therefore they are excluded. |
484 const bool force_rtl_directionality = | 485 const bool force_rtl_directionality = |
485 !(classifications[i].style & ACMatchClassification::URL) && | 486 !(classifications[i].style & ACMatchClassification::URL) && |
486 (run_direction == UBIDI_RTL) && | 487 (run_direction == UBIDI_RTL) && |
487 (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); | 488 !base::i18n::IsRTL(); |
488 | 489 |
489 if (text_start < text_end) { | 490 if (text_start < text_end) { |
490 x += DrawStringFragment(canvas, | 491 x += DrawStringFragment(canvas, |
491 text.substr(text_start, text_end - text_start), | 492 text.substr(text_start, text_end - text_start), |
492 style, x, y, force_rtl_directionality); | 493 style, x, y, force_rtl_directionality); |
493 } | 494 } |
494 } | 495 } |
495 } | 496 } |
496 return x; | 497 return x; |
497 } | 498 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 // static | 914 // static |
914 AutocompletePopupView* AutocompletePopupView::CreatePopupView( | 915 AutocompletePopupView* AutocompletePopupView::CreatePopupView( |
915 const gfx::Font& font, | 916 const gfx::Font& font, |
916 AutocompleteEditView* edit_view, | 917 AutocompleteEditView* edit_view, |
917 AutocompleteEditModel* edit_model, | 918 AutocompleteEditModel* edit_model, |
918 Profile* profile, | 919 Profile* profile, |
919 const BubblePositioner* bubble_positioner) { | 920 const BubblePositioner* bubble_positioner) { |
920 return new AutocompletePopupContentsView(font, edit_view, edit_model, | 921 return new AutocompletePopupContentsView(font, edit_view, edit_model, |
921 profile, bubble_positioner); | 922 profile, bubble_positioner); |
922 } | 923 } |
OLD | NEW |