OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.Callback; | 9 import org.chromium.base.Callback; |
10 import org.chromium.chrome.browser.payments.ui.EditorView; | 10 import org.chromium.chrome.browser.payments.ui.EditorView; |
11 import org.chromium.chrome.browser.payments.ui.PaymentOption; | 11 import org.chromium.chrome.browser.payments.ui.PaymentOption; |
12 | 12 |
13 import javax.annotation.Nullable; | 13 import javax.annotation.Nullable; |
14 | 14 |
15 /** | 15 /** |
16 * The base class for an editor controller. | 16 * The base class for an editor controller. |
17 */ | 17 */ |
18 abstract class EditorBase<T extends PaymentOption> { | 18 abstract class EditorBase<T extends PaymentOption> { |
19 @Nullable protected EditorView mEditorView; | 19 @Nullable protected EditorView mEditorView; |
20 @Nullable protected Context mContext; | 20 @Nullable protected Context mContext; |
21 | 21 |
22 /** | 22 /** |
23 * Sets the user interface to be used for editing contact information. | 23 * Sets the user interface to be used for editing payer information. |
24 * | 24 * |
25 * @param editorView The user interface to be used. | 25 * @param editorView The user interface to be used. |
26 */ | 26 */ |
27 public void setEditorView(EditorView editorView) { | 27 public void setEditorView(EditorView editorView) { |
28 assert editorView != null; | 28 assert editorView != null; |
29 mEditorView = editorView; | 29 mEditorView = editorView; |
30 mContext = mEditorView.getContext(); | 30 mContext = mEditorView.getContext(); |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Shows the user interface for editing the given information. | 34 * Shows the user interface for editing the given information. |
35 * | 35 * |
36 * @param toEdit The information to edit. Can be null if the user is addin
g new information | 36 * @param toEdit The information to edit. Can be null if the user is addin
g new information |
37 * instead of editing an existing one. | 37 * instead of editing an existing one. |
38 * @param callback The callback to invoke with the complete and valid inform
ation. Can be | 38 * @param callback The callback to invoke with the complete and valid inform
ation. Can be |
39 * invoked with null if the user clicked Cancel. | 39 * invoked with null if the user clicked Cancel. |
40 */ | 40 */ |
41 protected void edit(@Nullable T toEdit, Callback<T> callback) { | 41 protected void edit(@Nullable T toEdit, Callback<T> callback) { |
42 assert callback != null; | 42 assert callback != null; |
43 assert mEditorView != null; | 43 assert mEditorView != null; |
44 assert mContext != null; | 44 assert mContext != null; |
45 } | 45 } |
46 } | 46 } |
OLD | NEW |