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 22 matching lines...) Expand all Loading... | |
33 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
34 | 34 |
35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
36 #include "chrome/browser/android/chromium_application.h" | 36 #include "chrome/browser/android/chromium_application.h" |
37 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 37 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
38 #else | 38 #else |
39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
40 #include "components/ui/zoom/zoom_controller.h" | 40 #include "components/ui/zoom/zoom_controller.h" |
41 #endif | 41 #endif |
42 | 42 |
43 #if defined(ENABLE_EXTENSIONS) | |
44 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | |
45 #endif | |
46 | |
43 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 47 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
44 | 48 |
45 namespace autofill { | 49 namespace autofill { |
46 | 50 |
47 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 51 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
48 : content::WebContentsObserver(web_contents), | 52 : content::WebContentsObserver(web_contents), |
49 unmask_controller_(web_contents), | 53 unmask_controller_(web_contents), |
50 last_rfh_to_rac_(nullptr) { | 54 last_rfh_to_rac_(nullptr) { |
51 DCHECK(web_contents); | 55 DCHECK(web_contents); |
52 | 56 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 void ChromeAutofillClient::ShowAutofillPopup( | 182 void ChromeAutofillClient::ShowAutofillPopup( |
179 const gfx::RectF& element_bounds, | 183 const gfx::RectF& element_bounds, |
180 base::i18n::TextDirection text_direction, | 184 base::i18n::TextDirection text_direction, |
181 const std::vector<autofill::Suggestion>& suggestions, | 185 const std::vector<autofill::Suggestion>& suggestions, |
182 base::WeakPtr<AutofillPopupDelegate> delegate) { | 186 base::WeakPtr<AutofillPopupDelegate> delegate) { |
183 // Convert element_bounds to be in screen space. | 187 // Convert element_bounds to be in screen space. |
184 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 188 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
185 gfx::RectF element_bounds_in_screen_space = | 189 gfx::RectF element_bounds_in_screen_space = |
186 element_bounds + client_area.OffsetFromOrigin(); | 190 element_bounds + client_area.OffsetFromOrigin(); |
187 | 191 |
192 gfx::NativeView container_view = web_contents()->GetNativeView(); | |
193 // If the WebContents is inside a <webview>, use the embedder's native view, | |
194 // since the <webview> does not have its own native view. | |
195 #if defined(ENABLE_EXTENSIONS) | |
196 if (extensions::WebViewGuest::FromWebContents(web_contents())) | |
197 container_view = web_contents()->GetContentNativeView(); | |
198 #endif | |
199 | |
188 // Will delete or reuse the old |popup_controller_|. | 200 // Will delete or reuse the old |popup_controller_|. |
189 popup_controller_ = | 201 popup_controller_ = |
190 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, | 202 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, |
191 delegate, | 203 delegate, |
192 web_contents(), | 204 web_contents(), |
193 web_contents()->GetNativeView(), | 205 container_view, |
Evan Stade
2015/02/05 03:12:56
when I look at what this view is actually used for
noms (inactive)
2015/02/05 18:56:08
Done. I've tested it on all desktop platforms, and
| |
194 element_bounds_in_screen_space, | 206 element_bounds_in_screen_space, |
195 text_direction); | 207 text_direction); |
196 | 208 |
197 popup_controller_->Show(suggestions); | 209 popup_controller_->Show(suggestions); |
198 } | 210 } |
199 | 211 |
200 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( | 212 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( |
201 const std::vector<base::string16>& values, | 213 const std::vector<base::string16>& values, |
202 const std::vector<base::string16>& labels) { | 214 const std::vector<base::string16>& labels) { |
203 if (popup_controller_.get()) | 215 if (popup_controller_.get()) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); | 295 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); |
284 } | 296 } |
285 | 297 |
286 void ChromeAutofillClient::LinkClicked(const GURL& url, | 298 void ChromeAutofillClient::LinkClicked(const GURL& url, |
287 WindowOpenDisposition disposition) { | 299 WindowOpenDisposition disposition) { |
288 web_contents()->OpenURL(content::OpenURLParams( | 300 web_contents()->OpenURL(content::OpenURLParams( |
289 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); | 301 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); |
290 } | 302 } |
291 | 303 |
292 } // namespace autofill | 304 } // namespace autofill |
OLD | NEW |