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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 text_direction_(text_direction), | 106 text_direction_(text_direction), |
107 registered_key_press_event_callback_with_(NULL), | 107 registered_key_press_event_callback_with_(NULL), |
108 hide_on_outside_click_(false), | 108 hide_on_outside_click_(false), |
109 key_press_event_callback_( | 109 key_press_event_callback_( |
110 base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent, | 110 base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent, |
111 base::Unretained(this))), | 111 base::Unretained(this))), |
112 weak_ptr_factory_(this) { | 112 weak_ptr_factory_(this) { |
113 ClearState(); | 113 ClearState(); |
114 #if !defined(OS_ANDROID) | 114 #if !defined(OS_ANDROID) |
115 subtext_font_ = name_font_.DeriveFont(kLabelFontSizeDelta); | 115 subtext_font_ = name_font_.DeriveFont(kLabelFontSizeDelta); |
| 116 #if defined(OS_MACOSX) |
| 117 // There is no italic version of the system font. |
| 118 warning_font_ = name_font_; |
| 119 #else |
116 warning_font_ = name_font_.DeriveFont(0, gfx::Font::ITALIC); | 120 warning_font_ = name_font_.DeriveFont(0, gfx::Font::ITALIC); |
117 #endif | 121 #endif |
| 122 #endif |
118 } | 123 } |
119 | 124 |
120 AutofillPopupControllerImpl::~AutofillPopupControllerImpl() {} | 125 AutofillPopupControllerImpl::~AutofillPopupControllerImpl() {} |
121 | 126 |
122 void AutofillPopupControllerImpl::Show( | 127 void AutofillPopupControllerImpl::Show( |
123 const std::vector<string16>& names, | 128 const std::vector<string16>& names, |
124 const std::vector<string16>& subtexts, | 129 const std::vector<string16>& subtexts, |
125 const std::vector<string16>& icons, | 130 const std::vector<string16>& icons, |
126 const std::vector<int>& identifiers) { | 131 const std::vector<int>& identifiers) { |
127 SetValues(names, subtexts, icons, identifiers); | 132 SetValues(names, subtexts, icons, identifiers); |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 // The popup can appear below the field. | 763 // The popup can appear below the field. |
759 return std::make_pair(bottom_growth_start, popup_required_height); | 764 return std::make_pair(bottom_growth_start, popup_required_height); |
760 } else { | 765 } else { |
761 // The popup must appear above the field. | 766 // The popup must appear above the field. |
762 return std::make_pair(top_growth_end - popup_required_height, | 767 return std::make_pair(top_growth_end - popup_required_height, |
763 popup_required_height); | 768 popup_required_height); |
764 } | 769 } |
765 } | 770 } |
766 | 771 |
767 } // namespace autofill | 772 } // namespace autofill |
OLD | NEW |