| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_autofill_client.h" | 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void ChromeAutofillClient::ShowAutofillPopup( | 249 void ChromeAutofillClient::ShowAutofillPopup( |
| 250 const gfx::RectF& element_bounds, | 250 const gfx::RectF& element_bounds, |
| 251 base::i18n::TextDirection text_direction, | 251 base::i18n::TextDirection text_direction, |
| 252 const std::vector<autofill::Suggestion>& suggestions, | 252 const std::vector<autofill::Suggestion>& suggestions, |
| 253 base::WeakPtr<AutofillPopupDelegate> delegate) { | 253 base::WeakPtr<AutofillPopupDelegate> delegate) { |
| 254 // Convert element_bounds to be in screen space. | 254 // Convert element_bounds to be in screen space. |
| 255 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 255 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 256 gfx::RectF element_bounds_in_screen_space = | 256 gfx::RectF element_bounds_in_screen_space = |
| 257 element_bounds + client_area.OffsetFromOrigin(); | 257 element_bounds + client_area.OffsetFromOrigin(); |
| 258 | 258 |
| 259 if (element_bounds.IsEmpty() || |
| 260 !gfx::RectF(client_area).Contains(element_bounds_in_screen_space)) { |
| 261 // The field associated with the popup: |
| 262 // - takes up zero space (and is possibly not in the DOM), or |
| 263 // - is partially or fully outside the viewport, |
| 264 // so we suppress the popup to avoid crbug.com/678713 |
| 265 return; |
| 266 } |
| 267 |
| 259 // Will delete or reuse the old |popup_controller_|. | 268 // Will delete or reuse the old |popup_controller_|. |
| 260 popup_controller_ = | 269 popup_controller_ = |
| 261 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, | 270 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, |
| 262 delegate, | 271 delegate, |
| 263 web_contents(), | 272 web_contents(), |
| 264 web_contents()->GetNativeView(), | 273 web_contents()->GetNativeView(), |
| 265 element_bounds_in_screen_space, | 274 element_bounds_in_screen_space, |
| 266 text_direction); | 275 text_direction); |
| 267 | 276 |
| 268 popup_controller_->Show(suggestions); | 277 popup_controller_->Show(suggestions); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 404 } |
| 396 | 405 |
| 397 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { | 406 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { |
| 398 web_contents()->OpenURL(content::OpenURLParams( | 407 web_contents()->OpenURL(content::OpenURLParams( |
| 399 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), | 408 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), |
| 400 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 409 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 401 false /* is_renderer_initiated */)); | 410 false /* is_renderer_initiated */)); |
| 402 } | 411 } |
| 403 | 412 |
| 404 } // namespace autofill | 413 } // namespace autofill |
| OLD | NEW |