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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 sync_state_changed_callback_ = callback; | 91 sync_state_changed_callback_ = callback; |
92 | 92 |
93 // Invariant: Either sync_state_changed_callback_.is_null() is true | 93 // Invariant: Either sync_state_changed_callback_.is_null() is true |
94 // and this object is not subscribed as a | 94 // and this object is not subscribed as a |
95 // ProfileSyncServiceObserver, or | 95 // ProfileSyncServiceObserver, or |
96 // sync_state_changed_callback_.is_null() is false and this object | 96 // sync_state_changed_callback_.is_null() is false and this object |
97 // is subscribed as a ProfileSyncServiceObserver. | 97 // is subscribed as a ProfileSyncServiceObserver. |
98 } | 98 } |
99 | 99 |
100 void TabAutofillManagerDelegate::OnAutocheckoutError() { | 100 void TabAutofillManagerDelegate::OnAutocheckoutError() { |
| 101 // |dialog_controller_| is a WeakPtr, but we require it to be present when |
| 102 // |OnAutocheckoutError| is called, so we intentionally do not do NULL check. |
101 dialog_controller_->OnAutocheckoutError(); | 103 dialog_controller_->OnAutocheckoutError(); |
102 } | 104 } |
103 | 105 |
104 void TabAutofillManagerDelegate::ShowAutofillSettings() { | 106 void TabAutofillManagerDelegate::ShowAutofillSettings() { |
105 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
106 NOTIMPLEMENTED(); | 108 NOTIMPLEMENTED(); |
107 #else | 109 #else |
108 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 110 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
109 if (browser) | 111 if (browser) |
110 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); | 112 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 194 |
193 popup_controller_->Show(values, labels, icons, identifiers); | 195 popup_controller_->Show(values, labels, icons, identifiers); |
194 } | 196 } |
195 | 197 |
196 void TabAutofillManagerDelegate::HideAutofillPopup() { | 198 void TabAutofillManagerDelegate::HideAutofillPopup() { |
197 if (popup_controller_) | 199 if (popup_controller_) |
198 popup_controller_->Hide(); | 200 popup_controller_->Hide(); |
199 } | 201 } |
200 | 202 |
201 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { | 203 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
| 204 // |dialog_controller_| is a WeakPtr, but we require it to be present when |
| 205 // |UpdateProgressBar| is called, so we intentionally do not do NULL check. |
202 dialog_controller_->UpdateProgressBar(value); | 206 dialog_controller_->UpdateProgressBar(value); |
203 } | 207 } |
204 | 208 |
205 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { | 209 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
206 if (dialog_controller_) | 210 if (dialog_controller_) |
207 dialog_controller_->Hide(); | 211 dialog_controller_->Hide(); |
208 } | 212 } |
209 | 213 |
210 void TabAutofillManagerDelegate::OnStateChanged() { | 214 void TabAutofillManagerDelegate::OnStateChanged() { |
211 if (!sync_state_changed_callback_.is_null()) | 215 if (!sync_state_changed_callback_.is_null()) |
212 sync_state_changed_callback_.Run(); | 216 sync_state_changed_callback_.Run(); |
213 } | 217 } |
214 | 218 |
215 void TabAutofillManagerDelegate::DidNavigateMainFrame( | 219 void TabAutofillManagerDelegate::DidNavigateMainFrame( |
216 const content::LoadCommittedDetails& details, | 220 const content::LoadCommittedDetails& details, |
217 const content::FrameNavigateParams& params) { | 221 const content::FrameNavigateParams& params) { |
218 if (dialog_controller_ && | 222 if (dialog_controller_ && |
219 (dialog_controller_->dialog_type() == | 223 (dialog_controller_->dialog_type() == |
220 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 224 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
221 !dialog_controller_->AutocheckoutIsRunning())) { | 225 !dialog_controller_->AutocheckoutIsRunning())) { |
222 HideRequestAutocompleteDialog(); | 226 HideRequestAutocompleteDialog(); |
223 } | 227 } |
224 | 228 |
225 HideAutocheckoutBubble(); | 229 HideAutocheckoutBubble(); |
226 } | 230 } |
227 | 231 |
228 } // namespace autofill | 232 } // namespace autofill |
OLD | NEW |