| 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/tab_autofill_manager_delegate.h" | 5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" | 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" |
| 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 dialog_controller_ = AutofillDialogControllerImpl::Create(web_contents_, | 132 dialog_controller_ = AutofillDialogControllerImpl::Create(web_contents_, |
| 133 form, | 133 form, |
| 134 source_url, | 134 source_url, |
| 135 dialog_type, | 135 dialog_type, |
| 136 callback); | 136 callback); |
| 137 dialog_controller_->Show(); | 137 dialog_controller_->Show(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void TabAutofillManagerDelegate::ShowAutofillPopup( | 140 void TabAutofillManagerDelegate::ShowAutofillPopup( |
| 141 const gfx::RectF& element_bounds, | 141 const gfx::RectF& element_bounds, |
| 142 base::i18n::TextDirection text_direction, |
| 142 const std::vector<string16>& values, | 143 const std::vector<string16>& values, |
| 143 const std::vector<string16>& labels, | 144 const std::vector<string16>& labels, |
| 144 const std::vector<string16>& icons, | 145 const std::vector<string16>& icons, |
| 145 const std::vector<int>& identifiers, | 146 const std::vector<int>& identifiers, |
| 146 base::WeakPtr<AutofillPopupDelegate> delegate) { | 147 base::WeakPtr<AutofillPopupDelegate> delegate) { |
| 147 // Convert element_bounds to be in screen space. | 148 // Convert element_bounds to be in screen space. |
| 148 gfx::Rect client_area; | 149 gfx::Rect client_area; |
| 149 web_contents_->GetView()->GetContainerBounds(&client_area); | 150 web_contents_->GetView()->GetContainerBounds(&client_area); |
| 150 gfx::RectF element_bounds_in_screen_space = | 151 gfx::RectF element_bounds_in_screen_space = |
| 151 element_bounds + client_area.OffsetFromOrigin(); | 152 element_bounds + client_area.OffsetFromOrigin(); |
| 152 | 153 |
| 153 // Will delete or reuse the old |popup_controller_|. | 154 // Will delete or reuse the old |popup_controller_|. |
| 154 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( | 155 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( |
| 155 popup_controller_, | 156 popup_controller_, |
| 156 delegate, | 157 delegate, |
| 157 web_contents()->GetView()->GetNativeView(), | 158 web_contents()->GetView()->GetNativeView(), |
| 158 element_bounds_in_screen_space); | 159 element_bounds_in_screen_space, |
| 160 text_direction); |
| 159 | 161 |
| 160 popup_controller_->Show(values, labels, icons, identifiers); | 162 popup_controller_->Show(values, labels, icons, identifiers); |
| 161 } | 163 } |
| 162 | 164 |
| 163 void TabAutofillManagerDelegate::HideAutofillPopup() { | 165 void TabAutofillManagerDelegate::HideAutofillPopup() { |
| 164 if (popup_controller_.get()) | 166 if (popup_controller_.get()) |
| 165 popup_controller_->Hide(); | 167 popup_controller_->Hide(); |
| 166 } | 168 } |
| 167 | 169 |
| 168 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { | 170 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 186 if (dialog_controller_.get() && | 188 if (dialog_controller_.get() && |
| 187 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 189 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
| 188 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { | 190 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { |
| 189 HideRequestAutocompleteDialog(); | 191 HideRequestAutocompleteDialog(); |
| 190 } | 192 } |
| 191 | 193 |
| 192 HideAutocheckoutBubble(); | 194 HideAutocheckoutBubble(); |
| 193 } | 195 } |
| 194 | 196 |
| 195 } // namespace autofill | 197 } // namespace autofill |
| OLD | NEW |