OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autofill/autofill_popup_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return controller->GetWeakPtr(); | 94 return controller->GetWeakPtr(); |
95 } | 95 } |
96 | 96 |
97 AutofillPopupControllerImpl::AutofillPopupControllerImpl( | 97 AutofillPopupControllerImpl::AutofillPopupControllerImpl( |
98 base::WeakPtr<AutofillPopupDelegate> delegate, | 98 base::WeakPtr<AutofillPopupDelegate> delegate, |
99 content::WebContents* web_contents, | 99 content::WebContents* web_contents, |
100 gfx::NativeView container_view, | 100 gfx::NativeView container_view, |
101 const gfx::RectF& element_bounds, | 101 const gfx::RectF& element_bounds, |
102 base::i18n::TextDirection text_direction) | 102 base::i18n::TextDirection text_direction) |
103 : controller_common_(new PopupControllerCommon(element_bounds, | 103 : controller_common_(new PopupControllerCommon(element_bounds, |
| 104 text_direction, |
104 container_view, | 105 container_view, |
105 web_contents)), | 106 web_contents)), |
106 view_(NULL), | 107 view_(NULL), |
107 delegate_(delegate), | 108 delegate_(delegate), |
108 text_direction_(text_direction), | |
109 weak_ptr_factory_(this) { | 109 weak_ptr_factory_(this) { |
110 ClearState(); | 110 ClearState(); |
111 controller_common_->SetKeyPressCallback( | 111 controller_common_->SetKeyPressCallback( |
112 base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent, | 112 base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent, |
113 base::Unretained(this))); | 113 base::Unretained(this))); |
114 #if !defined(OS_ANDROID) | 114 #if !defined(OS_ANDROID) |
115 label_font_list_ = value_font_list_.DeriveWithSizeDelta(kLabelFontSizeDelta); | 115 label_font_list_ = value_font_list_.DeriveWithSizeDelta(kLabelFontSizeDelta); |
116 title_font_list_ = value_font_list_.DeriveWithStyle(gfx::Font::BOLD); | 116 title_font_list_ = value_font_list_.DeriveWithStyle(gfx::Font::BOLD); |
117 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
118 // There is no italic version of the system font. | 118 // There is no italic version of the system font. |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 gfx::NativeView AutofillPopupControllerImpl::container_view() { | 389 gfx::NativeView AutofillPopupControllerImpl::container_view() { |
390 return controller_common_->container_view(); | 390 return controller_common_->container_view(); |
391 } | 391 } |
392 | 392 |
393 const gfx::RectF& AutofillPopupControllerImpl::element_bounds() const { | 393 const gfx::RectF& AutofillPopupControllerImpl::element_bounds() const { |
394 return controller_common_->element_bounds(); | 394 return controller_common_->element_bounds(); |
395 } | 395 } |
396 | 396 |
397 bool AutofillPopupControllerImpl::IsRTL() const { | 397 bool AutofillPopupControllerImpl::IsRTL() const { |
398 return text_direction_ == base::i18n::RIGHT_TO_LEFT; | 398 return controller_common_->is_rtl(); |
399 } | 399 } |
400 | 400 |
401 size_t AutofillPopupControllerImpl::GetLineCount() const { | 401 size_t AutofillPopupControllerImpl::GetLineCount() const { |
402 return suggestions_.size(); | 402 return suggestions_.size(); |
403 } | 403 } |
404 | 404 |
405 const autofill::Suggestion& AutofillPopupControllerImpl::GetSuggestionAt( | 405 const autofill::Suggestion& AutofillPopupControllerImpl::GetSuggestionAt( |
406 size_t row) const { | 406 size_t row) const { |
407 return suggestions_[row]; | 407 return suggestions_[row]; |
408 } | 408 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 popup_bounds_ = gfx::Rect(); | 660 popup_bounds_ = gfx::Rect(); |
661 | 661 |
662 suggestions_.clear(); | 662 suggestions_.clear(); |
663 elided_values_.clear(); | 663 elided_values_.clear(); |
664 elided_labels_.clear(); | 664 elided_labels_.clear(); |
665 | 665 |
666 selected_line_ = kNoSelection; | 666 selected_line_ = kNoSelection; |
667 } | 667 } |
668 | 668 |
669 } // namespace autofill | 669 } // namespace autofill |
OLD | NEW |