Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc

Issue 23537014: rAc: Get rid of dialog type in rAc, there is only one type left now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_autofill_manager_delegate.h" 5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.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/autofill_cc_infobar_delegate.h" 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" 10 #include "chrome/browser/autofill/personal_data_manager_factory.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
14 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 14 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/chrome_pages.h" 18 #include "chrome/browser/ui/chrome_pages.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "components/autofill/content/browser/autofill_driver_impl.h" 21 #include "components/autofill/content/browser/autofill_driver_impl.h"
22 #include "components/autofill/core/common/autofill_messages.h" 22 #include "components/autofill/core/common/autofill_messages.h"
23 #include "components/autofill/core/common/autofill_pref_names.h" 23 #include "components/autofill/core/common/autofill_pref_names.h"
24 #include "content/public/browser/navigation_details.h"
25 #include "content/public/browser/navigation_entry.h"
26 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/web_contents_view.h" 25 #include "content/public/browser/web_contents_view.h"
28 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
29 27
30 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); 28 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate);
31 29
32 namespace autofill { 30 namespace autofill {
33 31
34 TabAutofillManagerDelegate::TabAutofillManagerDelegate( 32 TabAutofillManagerDelegate::TabAutofillManagerDelegate(
35 content::WebContents* web_contents) 33 content::WebContents* web_contents)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const base::Closure& save_card_callback) { 80 const base::Closure& save_card_callback) {
83 InfoBarService* infobar_service = 81 InfoBarService* infobar_service =
84 InfoBarService::FromWebContents(web_contents_); 82 InfoBarService::FromWebContents(web_contents_);
85 AutofillCCInfoBarDelegate::Create( 83 AutofillCCInfoBarDelegate::Create(
86 infobar_service, &metric_logger, save_card_callback); 84 infobar_service, &metric_logger, save_card_callback);
87 } 85 }
88 86
89 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( 87 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog(
90 const FormData& form, 88 const FormData& form,
91 const GURL& source_url, 89 const GURL& source_url,
92 DialogType dialog_type,
93 const base::Callback<void(const FormStructure*, 90 const base::Callback<void(const FormStructure*,
94 const std::string&)>& callback) { 91 const std::string&)>& callback) {
95 HideRequestAutocompleteDialog(); 92 HideRequestAutocompleteDialog();
96 93
97 dialog_controller_ = AutofillDialogController::Create(web_contents_, 94 dialog_controller_ = AutofillDialogController::Create(web_contents_,
98 form, 95 form,
99 source_url, 96 source_url,
100 dialog_type,
101 callback); 97 callback);
102 if (dialog_controller_) { 98 if (dialog_controller_) {
103 dialog_controller_->Show(); 99 dialog_controller_->Show();
104 } else { 100 } else {
105 callback.Run(NULL, std::string()); 101 callback.Run(NULL, std::string());
106 NOTIMPLEMENTED(); 102 NOTIMPLEMENTED();
107 } 103 }
108 } 104 }
109 105
110 void TabAutofillManagerDelegate::ShowAutofillPopup( 106 void TabAutofillManagerDelegate::ShowAutofillPopup(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return; 156 return;
161 host->Send(new AutofillMsg_PageShown(host->GetRoutingID())); 157 host->Send(new AutofillMsg_PageShown(host->GetRoutingID()));
162 } 158 }
163 159
164 void TabAutofillManagerDelegate::DidNavigateMainFrame( 160 void TabAutofillManagerDelegate::DidNavigateMainFrame(
165 const content::LoadCommittedDetails& details, 161 const content::LoadCommittedDetails& details,
166 const content::FrameNavigateParams& params) { 162 const content::FrameNavigateParams& params) {
167 if (!dialog_controller_.get()) 163 if (!dialog_controller_.get())
168 return; 164 return;
169 165
170 bool was_redirect = details.entry && 166 HideRequestAutocompleteDialog();
171 content::PageTransitionIsRedirect(details.entry->GetTransitionType());
172
173 if (dialog_controller_->GetDialogType() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE ||
174 !was_redirect) {
175 HideRequestAutocompleteDialog();
176 }
177 } 167 }
178 168
179 void TabAutofillManagerDelegate::WebContentsDestroyed( 169 void TabAutofillManagerDelegate::WebContentsDestroyed(
180 content::WebContents* web_contents) { 170 content::WebContents* web_contents) {
181 HideAutofillPopup(); 171 HideAutofillPopup();
182 } 172 }
183 173
184 } // namespace autofill 174 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698