diff options
author | bshe <bshe@chromium.org> | 2015-11-17 11:12:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-17 19:13:32 +0000 |
commit | 4c18758f292ffe08cec1da9642ca896484851b7f (patch) | |
tree | 4b28629433b3aefcbcf10d96edb06ee197459dd2 | |
parent | dd85fe85c3986fd3cf647d27e23a10244126c212 (diff) | |
download | chromium_src-4c18758f292ffe08cec1da9642ca896484851b7f.zip chromium_src-4c18758f292ffe08cec1da9642ca896484851b7f.tar.gz chromium_src-4c18758f292ffe08cec1da9642ca896484851b7f.tar.bz2 |
Enable GetValueFontListForRow and GetLabelFontList in AutofillPopupController for aura Android
For aura Android, AutofillPopupViewViews will be used. And
in its implementation, AutofillPopupController::GetValueFontListForRow
and AutofillPopupController::GetLabelFontList were used.
The two functions were disabled for Android. And the reason
was gfx::GetStringWidth is not implemented for Android. But
they are implemented for aura. So this CL enables them for
aura Android
BUG=507792
Review URL: https://codereview.chromium.org/1422533008
Cr-Commit-Position: refs/heads/master@{#360127}
3 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc index 857811f..1827dc7 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc @@ -40,7 +40,7 @@ const size_t kRowHeight = 24; // The vertical height of a separator in pixels. const size_t kSeparatorHeight = 1; -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // Size difference between name and label in pixels. const int kLabelFontSizeDelta = -2; @@ -62,7 +62,7 @@ const DataResource kDataResources[] = { { "jcbCC", IDR_AUTOFILL_CC_GENERIC }, { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD }, { "visaCC", IDR_AUTOFILL_CC_VISA }, -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) && !defined(USE_AURA) { "scanCreditCardIcon", IDR_AUTOFILL_CC_SCAN_NEW }, { "settings", IDR_AUTOFILL_SETTINGS }, #endif @@ -113,7 +113,7 @@ AutofillPopupControllerImpl::AutofillPopupControllerImpl( controller_common_->SetKeyPressCallback( base::Bind(&AutofillPopupControllerImpl::HandleKeyPressEvent, base::Unretained(this))); -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) label_font_list_ = value_font_list_.DeriveWithSizeDelta(kLabelFontSizeDelta); title_font_list_ = value_font_list_.DeriveWithStyle(gfx::Font::BOLD); #if defined(OS_MACOSX) @@ -133,7 +133,7 @@ void AutofillPopupControllerImpl::Show( DCHECK_EQ(suggestions_.size(), elided_values_.size()); DCHECK_EQ(suggestions_.size(), elided_labels_.size()); -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // Android displays the long text with ellipsis using the view attributes. UpdatePopupBounds(); @@ -310,7 +310,7 @@ bool AutofillPopupControllerImpl::HandleKeyPressEvent( } void AutofillPopupControllerImpl::UpdateBoundsAndRedrawPopup() { -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // TODO(csharp): Since UpdatePopupBounds can change the position of the popup, // the popup could end up jumping from above the element to below it. // It is unclear if it is better to keep the popup where it was, or if it @@ -359,10 +359,10 @@ int AutofillPopupControllerImpl::GetIconResourceID( } } -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) && !defined(USE_AURA) if (result == IDR_AUTOFILL_CC_SCAN_NEW && IsKeyboardAccessoryEnabled()) result = IDR_AUTOFILL_CC_SCAN_NEW_KEYBOARD_ACCESSORY; -#endif // OS_ANDROID +#endif return result; } @@ -460,7 +460,7 @@ bool AutofillPopupControllerImpl::RemoveSuggestion(int list_index) { return true; } -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) const gfx::FontList& AutofillPopupControllerImpl::GetValueFontListForRow( size_t index) const { if (suggestions_[index].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE) @@ -603,7 +603,7 @@ void AutofillPopupControllerImpl::InvalidateRow(size_t row) { view_->InvalidateRow(row); } -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) int AutofillPopupControllerImpl::GetDesiredPopupWidth() const { int popup_width = controller_common_->RoundedElementBounds().width(); for (size_t i = 0; i < GetLineCount(); ++i) { @@ -657,7 +657,7 @@ void AutofillPopupControllerImpl::UpdatePopupBounds() { popup_bounds_ = controller_common_->GetPopupBounds(popup_width, popup_height); } -#endif // !defined(OS_ANDROID) +#endif WeakPtr<AutofillPopupControllerImpl> AutofillPopupControllerImpl::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h index e854041..ecb981d 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h @@ -90,7 +90,7 @@ class AutofillPopupControllerImpl : public AutofillPopupController { base::string16* title, base::string16* body) override; bool RemoveSuggestion(int list_index) override; -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) const gfx::FontList& GetValueFontListForRow(size_t index) const override; const gfx::FontList& GetLabelFontList() const override; #endif @@ -133,7 +133,7 @@ class AutofillPopupControllerImpl : public AutofillPopupController { virtual void InvalidateRow(size_t row); // Protected so tests can access. -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // Calculates the desired width of the popup based on its contents. int GetDesiredPopupWidth() const; @@ -157,7 +157,7 @@ class AutofillPopupControllerImpl : public AutofillPopupController { // when the popup is reused it doesn't leak values between uses. void ClearState(); -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // Calculates and sets the bounds of the popup, including placing it properly // to prevent it from going off the screen. void UpdatePopupBounds(); @@ -180,7 +180,7 @@ class AutofillPopupControllerImpl : public AutofillPopupController { std::vector<base::string16> elided_values_; std::vector<base::string16> elided_labels_; -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // The fonts for the popup text. gfx::FontList value_font_list_; gfx::FontList label_font_list_; diff --git a/components/resources/autofill_scaled_resources.grdp b/components/resources/autofill_scaled_resources.grdp index ec1db8a..83b682c 100644 --- a/components/resources/autofill_scaled_resources.grdp +++ b/components/resources/autofill_scaled_resources.grdp @@ -6,7 +6,7 @@ <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_MASTERCARD" file="autofill/mastercard.png" /> <structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_VISA" file="autofill/visa.png" /> - <if expr="is_android"> + <if expr="is_android and not use_aura"> <!-- These are not used on desktop, only Android, so use a placeholder file. TODO(rouslan): Remove non-keyboard-accessory icon when keyboard accessory becomes default on Android. --> |