OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_popup_contents_view.
h" | 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
6 | 6 |
7 #include "app/bidi_line_iterator.h" | |
8 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
10 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
11 #include "app/text_elider.h" | 10 #include "app/text_elider.h" |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/i18n/bidi_line_iterator.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 16 #include "chrome/browser/autocomplete/autocomplete_match.h" |
17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
18 #include "chrome/browser/instant/instant_confirm_dialog.h" | 18 #include "chrome/browser/instant/instant_confirm_dialog.h" |
19 #include "chrome/browser/instant/promo_counter.h" | 19 #include "chrome/browser/instant/promo_counter.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/views/bubble_border.h" | 21 #include "chrome/browser/ui/views/bubble_border.h" |
22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 if (!(i->style & ACMatchClassification::URL)) { | 551 if (!(i->style & ACMatchClassification::URL)) { |
552 is_url = false; | 552 is_url = false; |
553 break; | 553 break; |
554 } | 554 } |
555 } | 555 } |
556 | 556 |
557 // Split the text into visual runs. We do this first so that we don't need to | 557 // Split the text into visual runs. We do this first so that we don't need to |
558 // worry about whether our eliding might change the visual display in | 558 // worry about whether our eliding might change the visual display in |
559 // unintended ways, e.g. by removing directional markings or by adding an | 559 // unintended ways, e.g. by removing directional markings or by adding an |
560 // ellipsis that's not enclosed in appropriate markings. | 560 // ellipsis that's not enclosed in appropriate markings. |
561 BiDiLineIterator bidi_line; | 561 base::i18n::BiDiLineIterator bidi_line; |
562 if (!bidi_line.Open(WideToUTF16Hack(text), base::i18n::IsRTL(), is_url)) | 562 if (!bidi_line.Open(WideToUTF16Hack(text), base::i18n::IsRTL(), is_url)) |
563 return x; | 563 return x; |
564 const int num_runs = bidi_line.CountRuns(); | 564 const int num_runs = bidi_line.CountRuns(); |
565 Runs runs; | 565 Runs runs; |
566 for (int run = 0; run < num_runs; ++run) { | 566 for (int run = 0; run < num_runs; ++run) { |
567 int run_start_int = 0, run_length_int = 0; | 567 int run_start_int = 0, run_length_int = 0; |
568 // The index we pass to GetVisualRun corresponds to the position of the run | 568 // The index we pass to GetVisualRun corresponds to the position of the run |
569 // in the displayed text. For example, the string "Google in HEBREW" (where | 569 // in the displayed text. For example, the string "Google in HEBREW" (where |
570 // HEBREW is text in the Hebrew language) has two runs: "Google in " which | 570 // HEBREW is text in the Hebrew language) has two runs: "Google in " which |
571 // is an LTR run, and "HEBREW" which is an RTL run. In an LTR context, the | 571 // is an LTR run, and "HEBREW" which is an RTL run. In an LTR context, the |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 opt_in_view_ = NULL; | 1204 opt_in_view_ = NULL; |
1205 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); | 1205 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); |
1206 DCHECK(counter); | 1206 DCHECK(counter); |
1207 counter->Hide(); | 1207 counter->Hide(); |
1208 if (opt_in) { | 1208 if (opt_in) { |
1209 browser::ShowInstantConfirmDialogIfNecessary( | 1209 browser::ShowInstantConfirmDialogIfNecessary( |
1210 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); | 1210 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); |
1211 } | 1211 } |
1212 UpdatePopupAppearance(); | 1212 UpdatePopupAppearance(); |
1213 } | 1213 } |
OLD | NEW |