| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 public: | 72 public: |
| 73 AutofillPopupControllerBrowserTest() {} | 73 AutofillPopupControllerBrowserTest() {} |
| 74 ~AutofillPopupControllerBrowserTest() override {} | 74 ~AutofillPopupControllerBrowserTest() override {} |
| 75 | 75 |
| 76 void SetUpOnMainThread() override { | 76 void SetUpOnMainThread() override { |
| 77 content::WebContents* web_contents = | 77 content::WebContents* web_contents = |
| 78 browser()->tab_strip_model()->GetActiveWebContents(); | 78 browser()->tab_strip_model()->GetActiveWebContents(); |
| 79 ASSERT_TRUE(web_contents != NULL); | 79 ASSERT_TRUE(web_contents != NULL); |
| 80 Observe(web_contents); | 80 Observe(web_contents); |
| 81 | 81 |
| 82 ContentAutofillDriver* driver = | 82 ContentAutofillDriver* driver = static_cast<ContentAutofillDriver*>( |
| 83 ContentAutofillDriverFactory::FromWebContents(web_contents) | 83 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 84 ->DriverForFrame(web_contents->GetMainFrame()); | 84 ->DriverForFrame(web_contents->GetMainFrame())); |
| 85 autofill_external_delegate_.reset( | 85 autofill_external_delegate_.reset( |
| 86 new TestAutofillExternalDelegate( | 86 new TestAutofillExternalDelegate( |
| 87 web_contents, | 87 web_contents, |
| 88 driver->autofill_manager(), | 88 driver->autofill_manager(), |
| 89 driver)); | 89 driver)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Normally the WebContents will automatically delete the delegate, but here | 92 // Normally the WebContents will automatically delete the delegate, but here |
| 93 // the delegate is owned by this test, so we have to manually destroy. | 93 // the delegate is owned by this test, so we have to manually destroy. |
| 94 void RenderFrameDeleted(content::RenderFrameHost* rfh) override { | 94 void RenderFrameDeleted(content::RenderFrameHost* rfh) override { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 DeleteDelegateBeforePopupHidden){ | 141 DeleteDelegateBeforePopupHidden){ |
| 142 GenerateTestAutofillPopup(autofill_external_delegate_.get()); | 142 GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
| 143 | 143 |
| 144 // Delete the external delegate here so that is gets deleted before popup is | 144 // Delete the external delegate here so that is gets deleted before popup is |
| 145 // hidden. This can happen if the web_contents are destroyed before the popup | 145 // hidden. This can happen if the web_contents are destroyed before the popup |
| 146 // is hidden. See http://crbug.com/232475 | 146 // is hidden. See http://crbug.com/232475 |
| 147 autofill_external_delegate_.reset(); | 147 autofill_external_delegate_.reset(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace autofill | 150 } // namespace autofill |
| OLD | NEW |