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/content/browser/autocheckout_request_manager.h" | |
6 | |
7 #include "components/autofill/core/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::vector<AutocheckoutStatistic>& latency_statistics, | |
43 const std::string& google_transaction_id) { | |
44 wallet_client_.SendAutocheckoutStatus(status, | |
45 source_url, | |
46 latency_statistics, | |
47 google_transaction_id); | |
48 } | |
49 | |
50 | |
51 const AutofillMetrics& AutocheckoutRequestManager::GetMetricLogger() const { | |
52 return metric_logger_; | |
53 } | |
54 | |
55 DialogType AutocheckoutRequestManager::GetDialogType() const { | |
56 return DIALOG_TYPE_AUTOCHECKOUT; | |
57 } | |
58 | |
59 std::string AutocheckoutRequestManager::GetRiskData() const { | |
60 NOTREACHED(); | |
61 return std::string(); | |
62 } | |
63 | |
64 std::string AutocheckoutRequestManager::GetWalletCookieValue() const { | |
65 return std::string(); | |
66 } | |
67 | |
68 bool AutocheckoutRequestManager::IsShippingAddressRequired() const { | |
69 NOTREACHED(); | |
70 return true; | |
71 } | |
72 | |
73 void AutocheckoutRequestManager::OnDidAcceptLegalDocuments() { | |
74 NOTREACHED(); | |
75 } | |
76 | |
77 void AutocheckoutRequestManager::OnDidAuthenticateInstrument(bool success) { | |
78 NOTREACHED(); | |
79 } | |
80 | |
81 void AutocheckoutRequestManager::OnDidGetFullWallet( | |
82 scoped_ptr<wallet::FullWallet> full_wallet) { | |
83 NOTREACHED(); | |
84 } | |
85 | |
86 void AutocheckoutRequestManager::OnDidGetWalletItems( | |
87 scoped_ptr<wallet::WalletItems> wallet_items) { | |
88 NOTREACHED(); | |
89 } | |
90 | |
91 | |
92 void AutocheckoutRequestManager::OnDidSaveToWallet( | |
93 const std::string& instrument_id, | |
94 const std::string& address_id, | |
95 const std::vector<wallet::RequiredAction>& required_actions, | |
96 const std::vector<wallet::FormFieldError>& form_field_errors) { | |
97 NOTREACHED(); | |
98 } | |
99 | |
100 void AutocheckoutRequestManager::OnWalletError( | |
101 wallet::WalletClient::ErrorType error_type) { | |
102 // Nothing to be done. |error_type| is logged by |metric_logger_|. | |
103 } | |
104 | |
105 AutocheckoutRequestManager::AutocheckoutRequestManager( | |
106 net::URLRequestContextGetter* request_context_getter) | |
107 : wallet_client_(request_context_getter, this) { | |
108 } | |
109 | |
110 } // namespace autofill | |
OLD | NEW |