| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "components/autofill/browser/autocheckout_page_meta_data.h" | 13 #include "components/autofill/browser/autocheckout_page_meta_data.h" |
| 14 #include "components/autofill/common/autocheckout_status.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 | 16 |
| 16 class AutofillField; | 17 class AutofillField; |
| 17 class AutofillManager; | 18 class AutofillManager; |
| 18 class AutofillProfile; | 19 class AutofillProfile; |
| 19 class CreditCard; | 20 class CreditCard; |
| 20 class FormStructure; | 21 class FormStructure; |
| 21 class GURL; | 22 class GURL; |
| 22 | 23 |
| 23 struct FormData; | 24 struct FormData; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 | 36 |
| 36 class AutocheckoutManager { | 37 class AutocheckoutManager { |
| 37 public: | 38 public: |
| 38 explicit AutocheckoutManager(AutofillManager* autofill_manager); | 39 explicit AutocheckoutManager(AutofillManager* autofill_manager); |
| 39 virtual ~AutocheckoutManager(); | 40 virtual ~AutocheckoutManager(); |
| 40 | 41 |
| 41 // Fill all the forms seen by the Autofill manager with the information | 42 // Fill all the forms seen by the Autofill manager with the information |
| 42 // gathered from the requestAutocomplete dialog. | 43 // gathered from the requestAutocomplete dialog. |
| 43 void FillForms(); | 44 void FillForms(); |
| 44 | 45 |
| 46 // Called when clicking a proceed element in an Autocheckout flow fails. |
| 47 // |status| is the reason for the failure. |
| 48 void OnClickFailed(AutocheckoutStatus status); |
| 49 |
| 45 // Sets |page_meta_data_| with the meta data for the current page. | 50 // Sets |page_meta_data_| with the meta data for the current page. |
| 46 void OnLoadedPageMetaData( | 51 void OnLoadedPageMetaData( |
| 47 scoped_ptr<AutocheckoutPageMetaData> page_meta_data); | 52 scoped_ptr<AutocheckoutPageMetaData> page_meta_data); |
| 48 | 53 |
| 49 // Called when a page containing forms is loaded. | 54 // Called when a page containing forms is loaded. |
| 50 void OnFormsSeen(); | 55 void OnFormsSeen(); |
| 51 | 56 |
| 52 // Causes the Autocheckout bubble to be displayed if the user hasn't seen it | 57 // Causes the Autocheckout bubble to be displayed if the user hasn't seen it |
| 53 // yet for the current page. |frame_url| is the page where Autocheckout is | 58 // yet for the current page. |frame_url| is the page where Autocheckout is |
| 54 // being initiated. |ssl_status| is the SSL status of the page. |native_view| | 59 // being initiated. |ssl_status| is the SSL status of the page. |native_view| |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 bool show_dialog); | 82 bool show_dialog); |
| 78 | 83 |
| 79 private: | 84 private: |
| 80 // Whether or not the current page is the start of a multipage Autofill flow. | 85 // Whether or not the current page is the start of a multipage Autofill flow. |
| 81 bool IsStartOfAutofillableFlow() const; | 86 bool IsStartOfAutofillableFlow() const; |
| 82 | 87 |
| 83 // Whether or not the current page is part of a multipage Autofill flow. | 88 // Whether or not the current page is part of a multipage Autofill flow. |
| 84 bool IsInAutofillableFlow() const; | 89 bool IsInAutofillableFlow() const; |
| 85 | 90 |
| 86 // Callback called from AutofillDialogController on filling up the UI form. | 91 // Callback called from AutofillDialogController on filling up the UI form. |
| 87 void ReturnAutocheckoutData(const FormStructure* result); | 92 void ReturnAutocheckoutData(const FormStructure* result, |
| 93 const std::string& google_transaction_id); |
| 88 | 94 |
| 89 // Sets value of form field data |field_to_fill| based on the Autofill | 95 // Sets value of form field data |field_to_fill| based on the Autofill |
| 90 // field type specified by |field|. | 96 // field type specified by |field|. |
| 91 void SetValue(const AutofillField& field, FormFieldData* field_to_fill); | 97 void SetValue(const AutofillField& field, FormFieldData* field_to_fill); |
| 92 | 98 |
| 93 AutofillManager* autofill_manager_; // WEAK; owns us | 99 AutofillManager* autofill_manager_; // WEAK; owns us |
| 94 | 100 |
| 95 // Credit card verification code. | 101 // Credit card verification code. |
| 96 string16 cvv_; | 102 string16 cvv_; |
| 97 | 103 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 108 // the current forms. Ensures the Autocheckout bubble is only shown to a | 114 // the current forms. Ensures the Autocheckout bubble is only shown to a |
| 109 // user once per pageview. | 115 // user once per pageview. |
| 110 bool autocheckout_offered_; | 116 bool autocheckout_offered_; |
| 111 | 117 |
| 112 // Whether or not the Autocheckout bubble is being displayed to the user. | 118 // Whether or not the Autocheckout bubble is being displayed to the user. |
| 113 bool is_autocheckout_bubble_showing_; | 119 bool is_autocheckout_bubble_showing_; |
| 114 | 120 |
| 115 // Whether or not the user is in an Autocheckout flow. | 121 // Whether or not the user is in an Autocheckout flow. |
| 116 bool in_autocheckout_flow_; | 122 bool in_autocheckout_flow_; |
| 117 | 123 |
| 124 std::string google_transaction_id_; |
| 125 |
| 118 base::WeakPtrFactory<AutocheckoutManager> weak_ptr_factory_; | 126 base::WeakPtrFactory<AutocheckoutManager> weak_ptr_factory_; |
| 119 | 127 |
| 120 DISALLOW_COPY_AND_ASSIGN(AutocheckoutManager); | 128 DISALLOW_COPY_AND_ASSIGN(AutocheckoutManager); |
| 121 }; | 129 }; |
| 122 | 130 |
| 123 } // namespace autofill | 131 } // namespace autofill |
| 124 | 132 |
| 125 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ | 133 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
| OLD | NEW |