summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 13:31:36 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 13:31:36 +0000
commit1483f9d99443d2d70105885c265fed874cdba12d (patch)
treea3f90c5bbf50d7fc06157b17a46067ea05c76676 /chrome/browser/autofill
parent991bf04e0511b28e1417f528942add9d07ebeaa5 (diff)
downloadchromium_src-1483f9d99443d2d70105885c265fed874cdba12d.zip
chromium_src-1483f9d99443d2d70105885c265fed874cdba12d.tar.gz
chromium_src-1483f9d99443d2d70105885c265fed874cdba12d.tar.bz2
Eliminate AutofillExternalDelegate being a WebContentsUserData
This CL changes AutofillExternalDelegate from being a WebContentsUserData to being owned by AutofillDriverImpl as part of making Autofill a layered component. BUG=247015 Review URL: https://chromiumcodereview.appspot.com/17225008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_browsertest.cc21
-rw-r--r--chrome/browser/autofill/autofill_interactive_uitest.cc23
2 files changed, 26 insertions, 18 deletions
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index ff5bd4a..d2d213f 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -229,12 +229,13 @@ class AutofillTest : public InProcessBrowserTest {
// allows us to forward keyboard events to the popup directly.
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
- AutofillManager* autofill_manager =
- AutofillDriverImpl::FromWebContents(web_contents)->autofill_manager();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ AutofillManager* autofill_manager = autofill_driver->autofill_manager();
if (autofill_manager->IsNativeUiEnabled()) {
- external_delegate_.reset(
+ scoped_ptr<AutofillExternalDelegate> external_delegate(
new TestAutofillExternalDelegate(web_contents, autofill_manager));
- autofill_manager->SetExternalDelegate(external_delegate_.get());
+ autofill_driver->SetAutofillExternalDelegate(external_delegate.Pass());
}
autofill_manager->SetTestDelegate(&test_delegate_);
}
@@ -472,7 +473,7 @@ class AutofillTest : public InProcessBrowserTest {
void SendKeyToPopupAndWait(ui::KeyboardCode key) {
// TODO(isherman): Remove this condition once the WebKit popup UI code is
// removed.
- if (!external_delegate_) {
+ if (!external_delegate()) {
// When testing the WebKit-based UI, route all keys to the page.
SendKeyToPageAndWait(key);
return;
@@ -483,7 +484,7 @@ class AutofillTest : public InProcessBrowserTest {
content::NativeWebKeyboardEvent event;
event.windowsKeyCode = key;
test_delegate_.Reset();
- external_delegate_->keyboard_listener()->HandleKeyPressEvent(event);
+ external_delegate()->keyboard_listener()->HandleKeyPressEvent(event);
test_delegate_.Wait();
}
@@ -522,14 +523,18 @@ class AutofillTest : public InProcessBrowserTest {
}
TestAutofillExternalDelegate* external_delegate() {
- return external_delegate_.get();
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ return static_cast<TestAutofillExternalDelegate*>(
+ autofill_driver->autofill_external_delegate());
}
AutofillManagerTestDelegateImpl test_delegate_;
private:
net::TestURLFetcherFactory url_fetcher_factory_;
- scoped_ptr<TestAutofillExternalDelegate> external_delegate_;
};
// http://crbug.com/150084
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc
index 242eccc..2199cb5 100644
--- a/chrome/browser/autofill/autofill_interactive_uitest.cc
+++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -206,12 +206,13 @@ class AutofillInteractiveTest : public InProcessBrowserTest {
// allows us to forward keyboard events to the popup directly.
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
- AutofillManager* autofill_manager =
- AutofillDriverImpl::FromWebContents(web_contents)->autofill_manager();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ AutofillManager* autofill_manager = autofill_driver->autofill_manager();
if (autofill_manager->IsNativeUiEnabled()) {
- external_delegate_.reset(
+ scoped_ptr<AutofillExternalDelegate> external_delegate(
new TestAutofillExternalDelegate(web_contents, autofill_manager));
- autofill_manager->SetExternalDelegate(external_delegate_.get());
+ autofill_driver->SetAutofillExternalDelegate(external_delegate.Pass());
}
autofill_manager->SetTestDelegate(&test_delegate_);
}
@@ -302,7 +303,7 @@ class AutofillInteractiveTest : public InProcessBrowserTest {
void SendKeyToPopupAndWait(ui::KeyboardCode key) {
// TODO(isherman): Remove this condition once the WebKit popup UI code is
// removed.
- if (!external_delegate_) {
+ if (!external_delegate()) {
// When testing the WebKit-based UI, route all keys to the page.
SendKeyToPageAndWait(key);
return;
@@ -313,18 +314,20 @@ class AutofillInteractiveTest : public InProcessBrowserTest {
content::NativeWebKeyboardEvent event;
event.windowsKeyCode = key;
test_delegate_.Reset();
- external_delegate_->keyboard_listener()->HandleKeyPressEvent(event);
+ external_delegate()->keyboard_listener()->HandleKeyPressEvent(event);
test_delegate_.Wait();
}
TestAutofillExternalDelegate* external_delegate() {
- return external_delegate_.get();
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ return static_cast<TestAutofillExternalDelegate*>(
+ autofill_driver->autofill_external_delegate());
}
AutofillManagerTestDelegateImpl test_delegate_;
-
- private:
- scoped_ptr<TestAutofillExternalDelegate> external_delegate_;
};
IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, DISABLED_AutofillSelectViaTab) {