OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/autofill/browser/autocheckout_request_manager.h" |
| 6 |
| 7 #include "components/autofill/browser/autofill_manager_delegate.h" |
| 8 #include "content/public/browser/browser_context.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 const char kAutocheckoutRequestManagerKey[] = |
| 13 "browser_context_autocheckout_request_manager"; |
| 14 |
| 15 } // namespace |
| 16 |
| 17 namespace autofill { |
| 18 |
| 19 AutocheckoutRequestManager::~AutocheckoutRequestManager() {} |
| 20 |
| 21 // static |
| 22 void AutocheckoutRequestManager::CreateForBrowserContext( |
| 23 content::BrowserContext* browser_context) { |
| 24 if (FromBrowserContext(browser_context)) |
| 25 return; |
| 26 |
| 27 browser_context->SetUserData( |
| 28 kAutocheckoutRequestManagerKey, |
| 29 new AutocheckoutRequestManager(browser_context->GetRequestContext())); |
| 30 } |
| 31 |
| 32 // static |
| 33 AutocheckoutRequestManager* AutocheckoutRequestManager::FromBrowserContext( |
| 34 content::BrowserContext* browser_context) { |
| 35 return static_cast<AutocheckoutRequestManager*>( |
| 36 browser_context->GetUserData(kAutocheckoutRequestManagerKey)); |
| 37 } |
| 38 |
| 39 void AutocheckoutRequestManager::SendAutocheckoutStatus( |
| 40 AutocheckoutStatus status, |
| 41 const GURL& source_url, |
| 42 const std::string& google_transaction_id) { |
| 43 wallet_client_.SendAutocheckoutStatus(status, |
| 44 source_url, |
| 45 google_transaction_id); |
| 46 } |
| 47 |
| 48 |
| 49 const AutofillMetrics& AutocheckoutRequestManager::GetMetricLogger() const { |
| 50 return metric_logger_; |
| 51 } |
| 52 |
| 53 DialogType AutocheckoutRequestManager::GetDialogType() const { |
| 54 return DIALOG_TYPE_AUTOCHECKOUT; |
| 55 } |
| 56 |
| 57 std::string AutocheckoutRequestManager::GetRiskData() const { |
| 58 NOTREACHED(); |
| 59 return std::string(); |
| 60 } |
| 61 |
| 62 void AutocheckoutRequestManager::OnDidAcceptLegalDocuments() { |
| 63 NOTREACHED(); |
| 64 } |
| 65 |
| 66 void AutocheckoutRequestManager::OnDidAuthenticateInstrument(bool success) { |
| 67 NOTREACHED(); |
| 68 } |
| 69 |
| 70 void AutocheckoutRequestManager::OnDidGetFullWallet( |
| 71 scoped_ptr<wallet::FullWallet> full_wallet) { |
| 72 NOTREACHED(); |
| 73 } |
| 74 |
| 75 void AutocheckoutRequestManager::OnDidGetWalletItems( |
| 76 scoped_ptr<wallet::WalletItems> wallet_items) { |
| 77 NOTREACHED(); |
| 78 } |
| 79 |
| 80 void AutocheckoutRequestManager::OnDidSaveAddress( |
| 81 const std::string& address_id, |
| 82 const std::vector<wallet::RequiredAction>& required_actions) { |
| 83 NOTREACHED(); |
| 84 } |
| 85 |
| 86 void AutocheckoutRequestManager::OnDidSaveInstrument( |
| 87 const std::string& instrument_id, |
| 88 const std::vector<wallet::RequiredAction>& required_actions) { |
| 89 NOTREACHED(); |
| 90 } |
| 91 |
| 92 void AutocheckoutRequestManager::OnDidSaveInstrumentAndAddress( |
| 93 const std::string& instrument_id, |
| 94 const std::string& address_id, |
| 95 const std::vector<wallet::RequiredAction>& required_actions) { |
| 96 NOTREACHED(); |
| 97 } |
| 98 |
| 99 void AutocheckoutRequestManager::OnDidUpdateAddress( |
| 100 const std::string& address_id, |
| 101 const std::vector<wallet::RequiredAction>& required_actions) { |
| 102 NOTREACHED(); |
| 103 } |
| 104 |
| 105 void AutocheckoutRequestManager::OnDidUpdateInstrument( |
| 106 const std::string& instrument_id, |
| 107 const std::vector<wallet::RequiredAction>& required_actions) { |
| 108 NOTREACHED(); |
| 109 } |
| 110 |
| 111 void AutocheckoutRequestManager::OnWalletError( |
| 112 wallet::WalletClient::ErrorType error_type) { |
| 113 // Nothing to be done. |error_type| is logged by |metric_logger_|. |
| 114 } |
| 115 |
| 116 void AutocheckoutRequestManager::OnMalformedResponse() { |
| 117 // Nothing to be done. |
| 118 } |
| 119 |
| 120 void AutocheckoutRequestManager::OnNetworkError(int response_code) { |
| 121 // Nothin to be done. |response_code| is logged by |metric_logger_|. |
| 122 } |
| 123 |
| 124 AutocheckoutRequestManager::AutocheckoutRequestManager( |
| 125 net::URLRequestContextGetter* request_context_getter) |
| 126 : wallet_client_(request_context_getter, this) { |
| 127 } |
| 128 |
| 129 } // namespace autofill |
OLD | NEW |