summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_manager_delegate.h
blob: dda8bfe33287bd8a0366ff724b2beb71aca29648 (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
// 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_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_
#define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_

namespace autofill {
class PasswordGenerator;
}

namespace content {
class BrowserContext;
}

namespace gfx {
class Rect;
}

namespace webkit {
namespace forms {
struct PasswordForm;
}
}

class InfoBarService;
class PrefServiceBase;
class Profile;
class ProfileSyncServiceBase;

namespace autofill {

// A delegate interface that needs to be supplied to AutofillManager
// by the embedder.
//
// Each delegate instance is associated with a given context within
// which an AutofillManager is used (e.g. a single tab), so when we
// say "for the delegate" below, we mean "in the execution context the
// delegate is associated with" (e.g. for the tab the AutofillManager is
// attached to).
class AutofillManagerDelegate {
 public:
  virtual ~AutofillManagerDelegate() {}

  // Gets the BrowserContext associated with the delegate.
  virtual content::BrowserContext* GetBrowserContext() const = 0;

  // Gets the BrowserContext associated with the delegate, or if in an
  // incognito mode, the associated (original) BrowserContext.
  virtual content::BrowserContext* GetOriginalBrowserContext() const = 0;

  // TODO(joi): Remove, this is temporary.
  virtual Profile* GetOriginalProfile() const = 0;

  // Gets the infobar service associated with the delegate.
  virtual InfoBarService* GetInfoBarService() = 0;

  // Gets the preferences associated with the delegate.
  virtual PrefServiceBase* GetPrefs() = 0;

  // Gets the profile sync service associated with the delegate.  Will
  // be NULL if sync is not enabled.
  virtual ProfileSyncServiceBase* GetProfileSyncService() = 0;

  // Returns true if saving passwords is currently enabled for the
  // delegate.
  virtual bool IsSavingPasswordsEnabled() const = 0;

  // Causes the Autofill settings UI to be shown.
  virtual void ShowAutofillSettings() = 0;

  // Causes the password generation bubble UI to be shown using the
  // specified form with the given bounds.
  virtual void ShowPasswordGenerationBubble(
      const gfx::Rect& bounds,
      const webkit::forms::PasswordForm& form,
      autofill::PasswordGenerator* generator) = 0;
};

}  // namespace autofill

#endif  // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_DELEGATE_H_