Chromium Code Reviews| 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 "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/personal_data_manager_factory.h" | 9 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/browser/ui/chrome_pages.h" | 23 #include "chrome/browser/ui/chrome_pages.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 25 #include "chrome/browser/webdata/web_data_service_factory.h" | 25 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "components/autofill/content/browser/content_autofill_driver.h" | 27 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 28 #include "components/autofill/content/common/autofill_messages.h" | 28 #include "components/autofill/content/common/autofill_messages.h" |
| 29 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" | 29 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" |
| 30 #include "components/autofill/core/common/autofill_pref_names.h" | 30 #include "components/autofill/core/common/autofill_pref_names.h" |
| 31 #include "components/password_manager/content/browser/content_password_manager_d river.h" | 31 #include "components/password_manager/content/browser/content_password_manager_d river.h" |
| 32 #include "content/public/browser/render_frame_host.h" | 32 #include "content/public/browser/render_frame_host.h" |
| 33 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | |
| 33 #include "ui/gfx/geometry/rect.h" | 34 #include "ui/gfx/geometry/rect.h" |
| 34 | 35 |
| 35 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
| 36 #include "chrome/browser/android/chromium_application.h" | 37 #include "chrome/browser/android/chromium_application.h" |
| 37 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 38 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 38 #else | 39 #else |
| 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 40 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 40 #include "components/ui/zoom/zoom_controller.h" | 41 #include "components/ui/zoom/zoom_controller.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 void ChromeAutofillClient::ShowAutofillPopup( | 179 void ChromeAutofillClient::ShowAutofillPopup( |
| 179 const gfx::RectF& element_bounds, | 180 const gfx::RectF& element_bounds, |
| 180 base::i18n::TextDirection text_direction, | 181 base::i18n::TextDirection text_direction, |
| 181 const std::vector<autofill::Suggestion>& suggestions, | 182 const std::vector<autofill::Suggestion>& suggestions, |
| 182 base::WeakPtr<AutofillPopupDelegate> delegate) { | 183 base::WeakPtr<AutofillPopupDelegate> delegate) { |
| 183 // Convert element_bounds to be in screen space. | 184 // Convert element_bounds to be in screen space. |
| 184 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 185 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 185 gfx::RectF element_bounds_in_screen_space = | 186 gfx::RectF element_bounds_in_screen_space = |
| 186 element_bounds + client_area.OffsetFromOrigin(); | 187 element_bounds + client_area.OffsetFromOrigin(); |
| 187 | 188 |
| 189 // If the webcontents is inside a webview, use the embedder's native view, | |
|
lazyboy
2015/02/05 00:39:50
s/webcontents/WebContents
s/webview/<webview>
noms (inactive)
2015/02/05 02:50:33
Done.
| |
| 190 // since the webview does not have its own native view. | |
| 191 gfx::NativeView container_view; | |
| 192 if (extensions::WebViewGuest::FromWebContents(web_contents())) | |
|
lazyboy
2015/02/05 00:43:56
#if defined(ENABLE_EXTENSIONS) this call and the h
noms (inactive)
2015/02/05 02:50:33
Yup, just noticed that. Done.
| |
| 193 container_view = web_contents()->GetContentNativeView(); | |
| 194 else | |
| 195 container_view = web_contents()->GetNativeView(); | |
| 196 | |
| 188 // Will delete or reuse the old |popup_controller_|. | 197 // Will delete or reuse the old |popup_controller_|. |
| 189 popup_controller_ = | 198 popup_controller_ = |
| 190 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, | 199 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, |
| 191 delegate, | 200 delegate, |
| 192 web_contents(), | 201 web_contents(), |
| 193 web_contents()->GetNativeView(), | 202 container_view, |
| 194 element_bounds_in_screen_space, | 203 element_bounds_in_screen_space, |
| 195 text_direction); | 204 text_direction); |
| 196 | 205 |
| 197 popup_controller_->Show(suggestions); | 206 popup_controller_->Show(suggestions); |
| 198 } | 207 } |
| 199 | 208 |
| 200 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( | 209 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( |
| 201 const std::vector<base::string16>& values, | 210 const std::vector<base::string16>& values, |
| 202 const std::vector<base::string16>& labels) { | 211 const std::vector<base::string16>& labels) { |
| 203 if (popup_controller_.get()) | 212 if (popup_controller_.get()) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); | 292 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); |
| 284 } | 293 } |
| 285 | 294 |
| 286 void ChromeAutofillClient::LinkClicked(const GURL& url, | 295 void ChromeAutofillClient::LinkClicked(const GURL& url, |
| 287 WindowOpenDisposition disposition) { | 296 WindowOpenDisposition disposition) { |
| 288 web_contents()->OpenURL(content::OpenURLParams( | 297 web_contents()->OpenURL(content::OpenURLParams( |
| 289 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); | 298 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); |
| 290 } | 299 } |
| 291 | 300 |
| 292 } // namespace autofill | 301 } // namespace autofill |
| OLD | NEW |