| 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 #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 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Call to disable communication to Online Wallet for this dialog. | 258 // Call to disable communication to Online Wallet for this dialog. |
| 259 // Exposed for testing. | 259 // Exposed for testing. |
| 260 void DisableWallet(); | 260 void DisableWallet(); |
| 261 | 261 |
| 262 // Returns whether Wallet is the current data source. Exposed for testing. | 262 // Returns whether Wallet is the current data source. Exposed for testing. |
| 263 virtual bool IsPayingWithWallet() const; | 263 virtual bool IsPayingWithWallet() const; |
| 264 | 264 |
| 265 // Exposed and virtual for testing. | 265 // Exposed and virtual for testing. |
| 266 virtual bool IsFirstRun() const; | 266 virtual bool IsFirstRun() const; |
| 267 | 267 |
| 268 // Asks risk module to asynchronously load fingerprint data. Data will be |
| 269 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. |
| 270 virtual void LoadRiskFingerprintData(); |
| 271 virtual void OnDidLoadRiskFingerprintData( |
| 272 scoped_ptr<risk::Fingerprint> fingerprint); |
| 273 |
| 268 // Opens the given URL in a new foreground tab. | 274 // Opens the given URL in a new foreground tab. |
| 269 virtual void OpenTabWithUrl(const GURL& url); | 275 virtual void OpenTabWithUrl(const GURL& url); |
| 270 | 276 |
| 271 private: | 277 private: |
| 272 // Whether or not the current request wants credit info back. | 278 // Whether or not the current request wants credit info back. |
| 273 bool RequestingCreditCardInfo() const; | 279 bool RequestingCreditCardInfo() const; |
| 274 | 280 |
| 275 // Whether the information input in this dialog will be securely transmitted | 281 // Whether the information input in this dialog will be securely transmitted |
| 276 // to the requesting site. | 282 // to the requesting site. |
| 277 bool TransmissionWillBeSecure() const; | 283 bool TransmissionWillBeSecure() const; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 std::vector<string16>* popup_values, | 373 std::vector<string16>* popup_values, |
| 368 std::vector<string16>* popup_labels, | 374 std::vector<string16>* popup_labels, |
| 369 std::vector<string16>* popup_icons); | 375 std::vector<string16>* popup_icons); |
| 370 | 376 |
| 371 // Like RequestedFieldsForSection, but returns a pointer. | 377 // Like RequestedFieldsForSection, but returns a pointer. |
| 372 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); | 378 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); |
| 373 | 379 |
| 374 // Hides |popup_controller_|'s popup view, if it exists. | 380 // Hides |popup_controller_|'s popup view, if it exists. |
| 375 void HidePopup(); | 381 void HidePopup(); |
| 376 | 382 |
| 377 // Asks risk module to asynchronously load fingerprint data. Data will be | |
| 378 // returned via OnDidLoadRiskFingerprintData. | |
| 379 void LoadRiskFingerprintData(); | |
| 380 void OnDidLoadRiskFingerprintData(scoped_ptr<risk::Fingerprint> fingerprint); | |
| 381 | |
| 382 // Whether the user has chosen to enter all new data in |section|. This | 383 // Whether the user has chosen to enter all new data in |section|. This |
| 383 // happens via choosing "Add a new X..." from a section's suggestion menu. | 384 // happens via choosing "Add a new X..." from a section's suggestion menu. |
| 384 bool IsManuallyEditingSection(DialogSection section) const; | 385 bool IsManuallyEditingSection(DialogSection section) const; |
| 385 | 386 |
| 386 // Whether the user has chosen to enter all new data in at least one section. | 387 // Whether the user has chosen to enter all new data in at least one section. |
| 387 bool IsManuallyEditingAnySection() const; | 388 bool IsManuallyEditingAnySection() const; |
| 388 | 389 |
| 389 // Returns true if the |value| is a valid string for the given autofill field | 390 // Returns true if the |value| is a valid string for the given autofill field |
| 390 // type. | 391 // type. |
| 391 bool InputIsValid(AutofillFieldType type, const string16& value) const; | 392 bool InputIsValid(AutofillFieldType type, const string16& value) const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 405 // Whether the billing section should be used to fill in the shipping details. | 406 // Whether the billing section should be used to fill in the shipping details. |
| 406 bool ShouldUseBillingForShipping(); | 407 bool ShouldUseBillingForShipping(); |
| 407 | 408 |
| 408 // Whether the user wishes to save information locally to Autofill. | 409 // Whether the user wishes to save information locally to Autofill. |
| 409 bool ShouldSaveDetailsLocally(); | 410 bool ShouldSaveDetailsLocally(); |
| 410 | 411 |
| 411 // Change whether the controller is currently submitting details to Autofill | 412 // Change whether the controller is currently submitting details to Autofill |
| 412 // or Online Wallet (|is_submitting_|) and update the view. | 413 // or Online Wallet (|is_submitting_|) and update the view. |
| 413 void SetIsSubmitting(bool submitting); | 414 void SetIsSubmitting(bool submitting); |
| 414 | 415 |
| 416 // Whether the user has accepted all the current legal documents' terms. |
| 417 bool AreLegalDocumentsCurrent() const; |
| 418 |
| 415 // Start the submit proccess to interact with Online Wallet (might do various | 419 // Start the submit proccess to interact with Online Wallet (might do various |
| 416 // things like accept documents, save details, update details, respond to | 420 // things like accept documents, save details, update details, respond to |
| 417 // required actions, etc.). | 421 // required actions, etc.). |
| 418 void SubmitWithWallet(); | 422 void SubmitWithWallet(); |
| 419 | 423 |
| 420 // Creates an instrument based on |views_|' contents. | 424 // Creates an instrument based on |views_|' contents. |
| 421 scoped_ptr<wallet::Instrument> CreateTransientInstrument(); | 425 scoped_ptr<wallet::Instrument> CreateTransientInstrument(); |
| 422 | 426 |
| 423 // Creates an update request based on |instrument|. May return NULL. | 427 // Creates an update request based on |instrument|. May return NULL. |
| 424 scoped_ptr<wallet::WalletClient::UpdateInstrumentRequest> | 428 scoped_ptr<wallet::WalletClient::UpdateInstrumentRequest> |
| 425 CreateUpdateInstrumentRequest(const wallet::Instrument* instrument, | 429 CreateUpdateInstrumentRequest(const wallet::Instrument* instrument, |
| 426 const std::string& instrument_id); | 430 const std::string& instrument_id); |
| 427 | 431 |
| 428 // Creates an address based on the contents of |view_|. | 432 // Creates an address based on the contents of |view_|. |
| 429 scoped_ptr<wallet::Address> CreateTransientAddress(); | 433 scoped_ptr<wallet::Address> CreateTransientAddress(); |
| 430 | 434 |
| 431 // Gets a full wallet from Online Wallet so the user can purchase something. | 435 // Gets a full wallet from Online Wallet so the user can purchase something. |
| 432 // This information is decoded to reveal a fronting (proxy) card. | 436 // This information is decoded to reveal a fronting (proxy) card. |
| 433 void GetFullWallet(); | 437 void GetFullWallet(); |
| 434 | 438 |
| 439 // Calls |GetFullWallet()| if the required members (|risk_data_|, |
| 440 // |active_instrument_id_|, and |active_address_id_|) are populated. |
| 441 void GetFullWalletIfReady(); |
| 442 |
| 435 // Updates the state of the controller and |view_| based on any required | 443 // Updates the state of the controller and |view_| based on any required |
| 436 // actions returned by Save or Update calls to Wallet. | 444 // actions returned by Save or Update calls to Wallet. |
| 437 void HandleSaveOrUpdateRequiredActions( | 445 void HandleSaveOrUpdateRequiredActions( |
| 438 const std::vector<wallet::RequiredAction>& required_actions); | 446 const std::vector<wallet::RequiredAction>& required_actions); |
| 439 | 447 |
| 440 // Whether submission is currently waiting for |action| to be handled. | 448 // Whether submission is currently waiting for |action| to be handled. |
| 441 bool IsSubmitPausedOn(wallet::RequiredAction action) const; | 449 bool IsSubmitPausedOn(wallet::RequiredAction action) const; |
| 442 | 450 |
| 443 // Called when there's nothing left to accept, update, save, or authenticate | 451 // Called when there's nothing left to accept, update, save, or authenticate |
| 444 // in order to fill |form_structure_| and pass data back to the invoking page. | 452 // in order to fill |form_structure_| and pass data back to the invoking page. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // The helper is set only during fetch/sign-in, and NULL otherwise. | 514 // The helper is set only during fetch/sign-in, and NULL otherwise. |
| 507 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; | 515 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; |
| 508 | 516 |
| 509 // A client to talk to the Online Wallet API. | 517 // A client to talk to the Online Wallet API. |
| 510 wallet::WalletClient wallet_client_; | 518 wallet::WalletClient wallet_client_; |
| 511 | 519 |
| 512 // Recently received items retrieved via |wallet_client_|. | 520 // Recently received items retrieved via |wallet_client_|. |
| 513 scoped_ptr<wallet::WalletItems> wallet_items_; | 521 scoped_ptr<wallet::WalletItems> wallet_items_; |
| 514 scoped_ptr<wallet::FullWallet> full_wallet_; | 522 scoped_ptr<wallet::FullWallet> full_wallet_; |
| 515 | 523 |
| 524 // Local machine signals to pass along on each request to trigger (or |
| 525 // discourage) risk challenges; sent if the user is up to date on legal docs. |
| 526 std::string risk_data_; |
| 527 |
| 516 // The text to display when the user is accepting new terms of service, etc. | 528 // The text to display when the user is accepting new terms of service, etc. |
| 517 string16 legal_documents_text_; | 529 string16 legal_documents_text_; |
| 518 // The ranges within |legal_documents_text_| to linkify. | 530 // The ranges within |legal_documents_text_| to linkify. |
| 519 std::vector<ui::Range> legal_document_link_ranges_; | 531 std::vector<ui::Range> legal_document_link_ranges_; |
| 520 | 532 |
| 521 // The instrument and address IDs from the Online Wallet server to be used | 533 // The instrument and address IDs from the Online Wallet server to be used |
| 522 // when getting a full wallet. | 534 // when getting a full wallet. |
| 523 std::string active_instrument_id_; | 535 std::string active_instrument_id_; |
| 524 std::string active_address_id_; | 536 std::string active_address_id_; |
| 525 | 537 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 scoped_ptr<AutofillDialogView> view_; | 574 scoped_ptr<AutofillDialogView> view_; |
| 563 | 575 |
| 564 // A NotificationRegistrar for tracking the completion of sign-in. | 576 // A NotificationRegistrar for tracking the completion of sign-in. |
| 565 content::NotificationRegistrar signin_registrar_; | 577 content::NotificationRegistrar signin_registrar_; |
| 566 | 578 |
| 567 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; | 579 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
| 568 | 580 |
| 569 // Whether this is the first time this profile has seen the Autofill dialog. | 581 // Whether this is the first time this profile has seen the Autofill dialog. |
| 570 bool is_first_run_; | 582 bool is_first_run_; |
| 571 | 583 |
| 584 // Whether a user accepted legal documents while this dialog is running. |
| 585 bool has_accepted_legal_documents_; |
| 586 |
| 572 // True after the user first accepts the dialog and presses "Submit". May | 587 // True after the user first accepts the dialog and presses "Submit". May |
| 573 // continue to be true while processing required actions. | 588 // continue to be true while processing required actions. |
| 574 bool is_submitting_; | 589 bool is_submitting_; |
| 575 | 590 |
| 576 // Whether or not there was a server side validation error saving or updating | 591 // Whether or not there was a server side validation error saving or updating |
| 577 // Wallet data. | 592 // Wallet data. |
| 578 bool wallet_server_validation_error_; | 593 bool wallet_server_validation_error_; |
| 579 | 594 |
| 580 // The current state of the Autocheckout flow. | 595 // The current state of the Autocheckout flow. |
| 581 AutocheckoutState autocheckout_state_; | 596 AutocheckoutState autocheckout_state_; |
| 582 | 597 |
| 583 // Whether the latency to display to the UI was logged to UMA yet. | 598 // Whether the latency to display to the UI was logged to UMA yet. |
| 584 bool was_ui_latency_logged_; | 599 bool was_ui_latency_logged_; |
| 585 | 600 |
| 586 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 601 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 587 }; | 602 }; |
| 588 | 603 |
| 589 } // namespace autofill | 604 } // namespace autofill |
| 590 | 605 |
| 591 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 606 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |