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