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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.h

Issue 13331007: Multi-account AccountChooser for interactive autocomplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after https://chromiumcodereview.appspot.com/13870019 Created 7 years, 8 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/browser/ui/autofill/account_chooser_model.h"
16 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 17 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
17 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 18 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
18 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 19 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
19 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
20 #include "chrome/browser/ui/autofill/country_combobox_model.h" 21 #include "chrome/browser/ui/autofill/country_combobox_model.h"
21 #include "components/autofill/browser/autofill_manager_delegate.h" 22 #include "components/autofill/browser/autofill_manager_delegate.h"
22 #include "components/autofill/browser/autofill_metrics.h" 23 #include "components/autofill/browser/autofill_metrics.h"
23 #include "components/autofill/browser/autofill_popup_delegate.h" 24 #include "components/autofill/browser/autofill_popup_delegate.h"
24 #include "components/autofill/browser/field_types.h" 25 #include "components/autofill/browser/field_types.h"
25 #include "components/autofill/browser/form_structure.h" 26 #include "components/autofill/browser/form_structure.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 virtual void OnWalletError( 198 virtual void OnWalletError(
198 wallet::WalletClient::ErrorType error_type) OVERRIDE; 199 wallet::WalletClient::ErrorType error_type) OVERRIDE;
199 virtual void OnMalformedResponse() OVERRIDE; 200 virtual void OnMalformedResponse() OVERRIDE;
200 virtual void OnNetworkError(int response_code) OVERRIDE; 201 virtual void OnNetworkError(int response_code) OVERRIDE;
201 202
202 // PersonalDataManagerObserver implementation. 203 // PersonalDataManagerObserver implementation.
203 virtual void OnPersonalDataChanged() OVERRIDE; 204 virtual void OnPersonalDataChanged() OVERRIDE;
204 205
205 // AccountChooserModelDelegate implementation. 206 // AccountChooserModelDelegate implementation.
206 virtual void AccountChoiceChanged() OVERRIDE; 207 virtual void AccountChoiceChanged() OVERRIDE;
208 virtual void UpdateAccountChooserView() OVERRIDE;
207 209
208 // wallet::WalletSigninHelperDelegate implementation. 210 // wallet::WalletSigninHelperDelegate implementation.
209 virtual void OnPassiveSigninSuccess( 211 virtual void OnPassiveSigninSuccess(const std::string& username) OVERRIDE;
210 const std::string& auth_username) OVERRIDE;
211 virtual void OnPassiveSigninFailure( 212 virtual void OnPassiveSigninFailure(
212 const GoogleServiceAuthError& error) OVERRIDE; 213 const GoogleServiceAuthError& error) OVERRIDE;
213 virtual void OnAutomaticSigninSuccess( 214 virtual void OnAutomaticSigninSuccess(const std::string& username) OVERRIDE;
214 const std::string& auth_username) OVERRIDE;
215 virtual void OnAutomaticSigninFailure( 215 virtual void OnAutomaticSigninFailure(
216 const GoogleServiceAuthError& error) OVERRIDE; 216 const GoogleServiceAuthError& error) OVERRIDE;
217 virtual void OnUserNameFetchSuccess( 217 virtual void OnUserNameFetchSuccess(const std::string& username) OVERRIDE;
218 const std::string& auth_username) OVERRIDE;
219 virtual void OnUserNameFetchFailure( 218 virtual void OnUserNameFetchFailure(
220 const GoogleServiceAuthError& error) OVERRIDE; 219 const GoogleServiceAuthError& error) OVERRIDE;
221 220
222 DialogType dialog_type() const { return dialog_type_; } 221 DialogType dialog_type() const { return dialog_type_; }
223 222
224 protected: 223 protected:
225 // Exposed for testing. 224 // Exposed for testing.
226 AutofillDialogControllerImpl( 225 AutofillDialogControllerImpl(
227 content::WebContents* contents, 226 content::WebContents* contents,
228 const FormData& form_structure, 227 const FormData& form_structure,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // address info. Incomplete profiles will not be displayed in the dropdown 266 // address info. Incomplete profiles will not be displayed in the dropdown
268 // menu. 267 // menu.
269 bool IsCompleteProfile(const AutofillProfile& profile); 268 bool IsCompleteProfile(const AutofillProfile& profile);
270 269
271 // Whether the user's wallet items have at least one address and instrument. 270 // Whether the user's wallet items have at least one address and instrument.
272 bool HasCompleteWallet() const; 271 bool HasCompleteWallet() const;
273 272
274 // Starts fetching the wallet items from Online Wallet. 273 // Starts fetching the wallet items from Online Wallet.
275 void GetWalletItems(); 274 void GetWalletItems();
276 275
276 // Handles the SignedInState() on Wallet or sign-in state update.
277 // Triggers the user name fetch and the passive/automatic sign-in.
278 void SignedInStateUpdated();
279
277 // Refreshes the model on Wallet or sign-in state update. 280 // Refreshes the model on Wallet or sign-in state update.
278 void OnWalletOrSigninUpdate(); 281 void OnWalletOrSigninUpdate();
279 282
280 // Should be called on the Wallet sign-in error. 283 // Should be called on the Wallet sign-in error.
281 void OnWalletSigninError(); 284 void OnWalletSigninError();
282 285
283 // Calculates |legal_documents_text_| and |legal_document_link_ranges_| if 286 // Calculates |legal_documents_text_| and |legal_document_link_ranges_| if
284 // they have not already been calculated. 287 // they have not already been calculated.
285 void EnsureLegalDocumentsText(); 288 void EnsureLegalDocumentsText();
286 289
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 base::Callback<void(const FormStructure*, const std::string&)> callback_; 446 base::Callback<void(const FormStructure*, const std::string&)> callback_;
444 447
445 // The AccountChooserModel acts as the MenuModel for the account chooser, 448 // The AccountChooserModel acts as the MenuModel for the account chooser,
446 // and also tracks which data source the dialog is using. 449 // and also tracks which data source the dialog is using.
447 AccountChooserModel account_chooser_model_; 450 AccountChooserModel account_chooser_model_;
448 451
449 // The sign-in helper to fetch the user info and perform passive sign-in. 452 // The sign-in helper to fetch the user info and perform passive sign-in.
450 // The helper is set only during fetch/sign-in, and NULL otherwise. 453 // The helper is set only during fetch/sign-in, and NULL otherwise.
451 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; 454 scoped_ptr<wallet::WalletSigninHelper> signin_helper_;
452 455
453 // The user account name (email).
454 // Valid only if PayingWithWallet() and SigninState() == SIGNED_IN.
455 // Set whenever the sign-in helper fetches the user info.
456 // TODO(aruslan): this should be removed (AccountChooser should deal with it).
457 std::string current_username_;
458
459 // A client to talk to the Online Wallet API. 456 // A client to talk to the Online Wallet API.
460 wallet::WalletClient wallet_client_; 457 wallet::WalletClient wallet_client_;
461 458
462 // Recently received items retrieved via |wallet_client_|. 459 // Recently received items retrieved via |wallet_client_|.
463 scoped_ptr<wallet::WalletItems> wallet_items_; 460 scoped_ptr<wallet::WalletItems> wallet_items_;
464 scoped_ptr<wallet::FullWallet> full_wallet_; 461 scoped_ptr<wallet::FullWallet> full_wallet_;
465 462
466 // The text to display when the user is accepting new terms of service, etc. 463 // The text to display when the user is accepting new terms of service, etc.
467 string16 legal_documents_text_; 464 string16 legal_documents_text_;
468 // The ranges within |legal_documents_text_| to linkify. 465 // The ranges within |legal_documents_text_| to linkify.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 524
528 // Whether or not there was an error in the Autocheckout flow. 525 // Whether or not there was an error in the Autocheckout flow.
529 bool had_autocheckout_error_; 526 bool had_autocheckout_error_;
530 527
531 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); 528 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
532 }; 529 };
533 530
534 } // namespace autofill 531 } // namespace autofill
535 532
536 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 533 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698