summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/autofill/autofill_dialog_view.h
blob: aa27201f564bcc4d14afad154c35da7aa3d878d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_

#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"

namespace content {
class NavigationController;
}

namespace gfx {
class Point;
class Size;
}

namespace autofill {

class AutofillDialogViewDelegate;
class TestableAutofillDialogView;

// An interface for the dialog that appears when a site initiates an Autofill
// action via the imperative autocomplete API.
class AutofillDialogView {
 public:
  virtual ~AutofillDialogView();

  // Shows the dialog.
  virtual void Show() = 0;

  // Closes the dialog window. May self-delete.
  virtual void Hide() = 0;

  // A hint that the view is going to receive a series of Update* calls soon,
  // and may want to delay visible changes until after the updates are over.
  // As multiple calls to UpdatesStarted may be stacked, and the view should
  // expect an equal number of calls to UpdateFinished().
  virtual void UpdatesStarted() = 0;

  // The matching call to UpdatesStarted.
  virtual void UpdatesFinished() = 0;

  // Called when a different notification is available.
  virtual void UpdateNotificationArea() = 0;

  // Called when account details may have changed (user logs in to GAIA, creates
  // a new account, etc.).
  virtual void UpdateAccountChooser() = 0;

  // Updates the button strip based on the current controller state.
  virtual void UpdateButtonStrip() = 0;

  // Updates the dialog overlay in response to a change of state or animation
  // progression.
  virtual void UpdateOverlay() = 0;

  // Updates the container for the detail inputs.
  virtual void UpdateDetailArea() = 0;

  // Updates the validity status of the detail inputs.
  virtual void UpdateForErrors() = 0;

  // Called when the contents of a section have changed.
  virtual void UpdateSection(DialogSection section) = 0;

  // Updates the error bubble for this view.
  virtual void UpdateErrorBubble() = 0;

  // Fills the given section with Autofill data that was triggered by a user
  // interaction with |originating_input|.
  virtual void FillSection(DialogSection section,
                           const DetailInput& originating_input) = 0;

  // Fills |output| with data the user manually input.
  virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0;

  // Gets the CVC value the user typed to go along with the stored credit card
  // data. If the user is inputing credit card data from scratch, this is not
  // relevant.
  virtual string16 GetCvc() = 0;

  // Whether or not |point| is within |input|'s bounds.
  virtual bool HitTestInput(const DetailInput& input,
                            const gfx::Point& screen_point) = 0;

  // Returns true if new or edited autofill details should be saved.
  virtual bool SaveDetailsLocally() = 0;

  // Triggers dialog to sign in to Google.
  // Returns a NotificationSource to be used to monitor for sign-in completion.
  virtual const content::NavigationController* ShowSignIn() = 0;

  // Closes out any sign-in UI and returns to normal operation.
  virtual void HideSignIn() = 0;

  // Called when the active suggestions data model changed.
  virtual void ModelChanged() = 0;

  // Returns an object that can be used to test that the view is behaving as
  // expected.
  virtual TestableAutofillDialogView* GetTestableView() = 0;

  // Called by AutofillDialogSignInDelegate when the sign-in page experiences a
  // resize. |pref_size| is the new preferred size of the sign-in page.
  virtual void OnSignInResize(const gfx::Size& pref_size) = 0;

  // Factory function to create the dialog (implemented once per view
  // implementation). |controller| will own the created dialog.
  static AutofillDialogView* Create(AutofillDialogViewDelegate* delegate);
};

}  // namespace autofill

#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_