| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "base/string16.h" | 15 #include "base/string16.h" |
| 15 #include "base/time.h" | 16 #include "base/time.h" |
| 16 #include "chrome/browser/ui/autofill/account_chooser_model.h" | 17 #include "chrome/browser/ui/autofill/account_chooser_model.h" |
| 17 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 18 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 18 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 19 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 19 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 20 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 21 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 21 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 22 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Call to disable communication to Online Wallet for this dialog. | 247 // Call to disable communication to Online Wallet for this dialog. |
| 247 // Exposed for testing. | 248 // Exposed for testing. |
| 248 void DisableWallet(); | 249 void DisableWallet(); |
| 249 | 250 |
| 250 // Returns whether Wallet is the current data source. Exposed for testing. | 251 // Returns whether Wallet is the current data source. Exposed for testing. |
| 251 virtual bool IsPayingWithWallet() const; | 252 virtual bool IsPayingWithWallet() const; |
| 252 | 253 |
| 253 // Exposed and virtual for testing. | 254 // Exposed and virtual for testing. |
| 254 virtual bool IsFirstRun() const; | 255 virtual bool IsFirstRun() const; |
| 255 | 256 |
| 257 // Asks risk module to asynchronously load fingerprint data. Data will be |
| 258 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. |
| 259 virtual void LoadRiskFingerprintData(); |
| 260 |
| 261 // Basically exists for testing, which is why |fingerprint| is a pointer |
| 262 // rather than const-ref (as it can be NULL this way). |
| 263 virtual void SerializeFingerprint(risk::Fingerprint* fingerprint, |
| 264 std::string* data); |
| 265 |
| 256 private: | 266 private: |
| 267 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, |
| 268 RiskLoadsWithoutPendingLegalDocuments); |
| 269 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, |
| 270 RiskLoadsAfterAcceptingLegalDocuments); |
| 271 |
| 257 // Whether or not the current request wants credit info back. | 272 // Whether or not the current request wants credit info back. |
| 258 bool RequestingCreditCardInfo() const; | 273 bool RequestingCreditCardInfo() const; |
| 259 | 274 |
| 260 // Whether the information input in this dialog will be securely transmitted | 275 // Whether the information input in this dialog will be securely transmitted |
| 261 // to the requesting site. | 276 // to the requesting site. |
| 262 bool TransmissionWillBeSecure() const; | 277 bool TransmissionWillBeSecure() const; |
| 263 | 278 |
| 264 // Initializes |suggested_email_| et al. | 279 // Initializes |suggested_email_| et al. |
| 265 void SuggestionsUpdated(); | 280 void SuggestionsUpdated(); |
| 266 | 281 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 std::vector<string16>* popup_values, | 368 std::vector<string16>* popup_values, |
| 354 std::vector<string16>* popup_labels, | 369 std::vector<string16>* popup_labels, |
| 355 std::vector<string16>* popup_icons); | 370 std::vector<string16>* popup_icons); |
| 356 | 371 |
| 357 // Like RequestedFieldsForSection, but returns a pointer. | 372 // Like RequestedFieldsForSection, but returns a pointer. |
| 358 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); | 373 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); |
| 359 | 374 |
| 360 // Hides |popup_controller_|'s popup view, if it exists. | 375 // Hides |popup_controller_|'s popup view, if it exists. |
| 361 void HidePopup(); | 376 void HidePopup(); |
| 362 | 377 |
| 363 // Asks risk module to asynchronously load fingerprint data. Data will be | 378 // Called when loading of risk fingerprint data is done. |
| 364 // returned via OnDidLoadRiskFingerprintData. | |
| 365 void LoadRiskFingerprintData(); | |
| 366 void OnDidLoadRiskFingerprintData(scoped_ptr<risk::Fingerprint> fingerprint); | 379 void OnDidLoadRiskFingerprintData(scoped_ptr<risk::Fingerprint> fingerprint); |
| 367 | 380 |
| 368 // Whether the user has chosen to enter all new data in |section|. This | 381 // Whether the user has chosen to enter all new data in |section|. This |
| 369 // happens via choosing "Add a new X..." from a section's suggestion menu. | 382 // happens via choosing "Add a new X..." from a section's suggestion menu. |
| 370 bool IsManuallyEditingSection(DialogSection section) const; | 383 bool IsManuallyEditingSection(DialogSection section) const; |
| 371 | 384 |
| 372 // Whether the user has chosen to enter all new data in at least one section. | 385 // Whether the user has chosen to enter all new data in at least one section. |
| 373 bool IsManuallyEditingAnySection() const; | 386 bool IsManuallyEditingAnySection() const; |
| 374 | 387 |
| 375 // Whether all of the input fields currently showing in the dialog have valid | 388 // Whether all of the input fields currently showing in the dialog have valid |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // The helper is set only during fetch/sign-in, and NULL otherwise. | 485 // The helper is set only during fetch/sign-in, and NULL otherwise. |
| 473 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; | 486 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; |
| 474 | 487 |
| 475 // A client to talk to the Online Wallet API. | 488 // A client to talk to the Online Wallet API. |
| 476 wallet::WalletClient wallet_client_; | 489 wallet::WalletClient wallet_client_; |
| 477 | 490 |
| 478 // Recently received items retrieved via |wallet_client_|. | 491 // Recently received items retrieved via |wallet_client_|. |
| 479 scoped_ptr<wallet::WalletItems> wallet_items_; | 492 scoped_ptr<wallet::WalletItems> wallet_items_; |
| 480 scoped_ptr<wallet::FullWallet> full_wallet_; | 493 scoped_ptr<wallet::FullWallet> full_wallet_; |
| 481 | 494 |
| 495 // Local machine signals to pass along on each request to trigger (or |
| 496 // discourage) risk challenges; sent if the user is up to date on legal docs. |
| 497 std::string risk_data_; |
| 498 |
| 482 // The text to display when the user is accepting new terms of service, etc. | 499 // The text to display when the user is accepting new terms of service, etc. |
| 483 string16 legal_documents_text_; | 500 string16 legal_documents_text_; |
| 484 // The ranges within |legal_documents_text_| to linkify. | 501 // The ranges within |legal_documents_text_| to linkify. |
| 485 std::vector<ui::Range> legal_document_link_ranges_; | 502 std::vector<ui::Range> legal_document_link_ranges_; |
| 486 | 503 |
| 487 // Used to remember the state of Wallet comboboxes when Submit was clicked. | 504 // Used to remember the state of Wallet comboboxes when Submit was clicked. |
| 488 std::string active_instrument_id_; | 505 std::string active_instrument_id_; |
| 489 std::string active_address_id_; | 506 std::string active_address_id_; |
| 490 | 507 |
| 491 // The fields for billing and shipping which the page has actually requested. | 508 // The fields for billing and shipping which the page has actually requested. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 scoped_ptr<AutofillDialogView> view_; | 544 scoped_ptr<AutofillDialogView> view_; |
| 528 | 545 |
| 529 // A NotificationRegistrar for tracking the completion of sign-in. | 546 // A NotificationRegistrar for tracking the completion of sign-in. |
| 530 content::NotificationRegistrar registrar_; | 547 content::NotificationRegistrar registrar_; |
| 531 | 548 |
| 532 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; | 549 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
| 533 | 550 |
| 534 // Whether this is the first time this profile has seen the Autofill dialog. | 551 // Whether this is the first time this profile has seen the Autofill dialog. |
| 535 bool is_first_run_; | 552 bool is_first_run_; |
| 536 | 553 |
| 554 // Whether a user's legal documents are up to date. |
| 555 bool legal_documents_are_current_; |
| 556 |
| 537 // True after the user first accepts the dialog and presses "Submit". May | 557 // True after the user first accepts the dialog and presses "Submit". May |
| 538 // continue to be true while processing required actions. | 558 // continue to be true while processing required actions. |
| 539 bool is_submitting_; | 559 bool is_submitting_; |
| 540 | 560 |
| 541 // Whether or not an Autocheckout flow is running. | 561 // Whether or not an Autocheckout flow is running. |
| 542 bool autocheckout_is_running_; | 562 bool autocheckout_is_running_; |
| 543 | 563 |
| 544 // Whether or not there was an error in the Autocheckout flow. | 564 // Whether or not there was an error in the Autocheckout flow. |
| 545 bool had_autocheckout_error_; | 565 bool had_autocheckout_error_; |
| 546 | 566 |
| 547 // Whether the latency to display to the UI was logged to UMA yet. | 567 // Whether the latency to display to the UI was logged to UMA yet. |
| 548 bool was_ui_latency_logged_; | 568 bool was_ui_latency_logged_; |
| 549 | 569 |
| 550 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 570 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 551 }; | 571 }; |
| 552 | 572 |
| 553 } // namespace autofill | 573 } // namespace autofill |
| 554 | 574 |
| 555 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 575 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |