| OLD | NEW |
| 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/autocheckout_whitelist_manager_factory.h" | 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" |
| 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 new AutocheckoutBubbleController( | 110 new AutocheckoutBubbleController( |
| 111 anchor, | 111 anchor, |
| 112 web_contents_->GetView()->GetTopLevelNativeWindow(), | 112 web_contents_->GetView()->GetTopLevelNativeWindow(), |
| 113 is_google_user, | 113 is_google_user, |
| 114 callback))); | 114 callback))); |
| 115 autocheckout_bubble_->ShowBubble(); | 115 autocheckout_bubble_->ShowBubble(); |
| 116 #endif // #if !defined(TOOLKIT_VIEWS) | 116 #endif // #if !defined(TOOLKIT_VIEWS) |
| 117 } | 117 } |
| 118 | 118 |
| 119 void TabAutofillManagerDelegate::HideAutocheckoutBubble() { | 119 void TabAutofillManagerDelegate::HideAutocheckoutBubble() { |
| 120 if (autocheckout_bubble_) | 120 if (autocheckout_bubble_.get()) |
| 121 autocheckout_bubble_->HideBubble(); | 121 autocheckout_bubble_->HideBubble(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( | 124 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( |
| 125 const FormData& form, | 125 const FormData& form, |
| 126 const GURL& source_url, | 126 const GURL& source_url, |
| 127 DialogType dialog_type, | 127 DialogType dialog_type, |
| 128 const base::Callback<void(const FormStructure*, | 128 const base::Callback<void(const FormStructure*, |
| 129 const std::string&)>& callback) { | 129 const std::string&)>& callback) { |
| 130 HideRequestAutocompleteDialog(); | 130 HideRequestAutocompleteDialog(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 154 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( | 154 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( |
| 155 popup_controller_, | 155 popup_controller_, |
| 156 delegate, | 156 delegate, |
| 157 web_contents()->GetView()->GetNativeView(), | 157 web_contents()->GetView()->GetNativeView(), |
| 158 element_bounds_in_screen_space); | 158 element_bounds_in_screen_space); |
| 159 | 159 |
| 160 popup_controller_->Show(values, labels, icons, identifiers); | 160 popup_controller_->Show(values, labels, icons, identifiers); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void TabAutofillManagerDelegate::HideAutofillPopup() { | 163 void TabAutofillManagerDelegate::HideAutofillPopup() { |
| 164 if (popup_controller_) | 164 if (popup_controller_.get()) |
| 165 popup_controller_->Hide(); | 165 popup_controller_->Hide(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { | 168 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
| 169 // |dialog_controller_| is a WeakPtr, but we require it to be present when | 169 // |dialog_controller_| is a WeakPtr, but we require it to be present when |
| 170 // |UpdateProgressBar| is called, so we intentionally do not do NULL check. | 170 // |UpdateProgressBar| is called, so we intentionally do not do NULL check. |
| 171 dialog_controller_->UpdateProgressBar(value); | 171 dialog_controller_->UpdateProgressBar(value); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { | 174 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
| 175 if (dialog_controller_) | 175 if (dialog_controller_.get()) |
| 176 dialog_controller_->Hide(); | 176 dialog_controller_->Hide(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void TabAutofillManagerDelegate::DidNavigateMainFrame( | 179 void TabAutofillManagerDelegate::DidNavigateMainFrame( |
| 180 const content::LoadCommittedDetails& details, | 180 const content::LoadCommittedDetails& details, |
| 181 const content::FrameNavigateParams& params) { | 181 const content::FrameNavigateParams& params) { |
| 182 // A redirect immediately after a successful Autocheckout flow shouldn't hide | 182 // A redirect immediately after a successful Autocheckout flow shouldn't hide |
| 183 // the dialog. | 183 // the dialog. |
| 184 bool was_redirect = details.entry && | 184 bool was_redirect = details.entry && |
| 185 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); | 185 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); |
| 186 if (dialog_controller_ && | 186 if (dialog_controller_.get() && |
| 187 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 187 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
| 188 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { | 188 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { |
| 189 HideRequestAutocompleteDialog(); | 189 HideRequestAutocompleteDialog(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 HideAutocheckoutBubble(); | 192 HideAutocheckoutBubble(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace autofill | 195 } // namespace autofill |
| OLD | NEW |