summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager/password_manager_delegate.h
blob: db68dc51bb5fb6d47e7a3c8b5cba2e215d60d754 (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
// 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_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_
#pragma once

namespace webkit {
namespace forms {
struct PasswordFormFillData;
}
}

class PasswordFormManager;
class Profile;

// An abstraction of operations in the external environment (TabContents)
// that the PasswordManager depends on.  This allows for more targeted
// unit testing.
class PasswordManagerDelegate {
 public:
  PasswordManagerDelegate() {}
  virtual ~PasswordManagerDelegate() {}

  // Fill forms matching |form_data| in |tab_contents|.  By default, goes
  // through the RenderViewHost to FillPasswordForm.  Tests can override this
  // to sever the dependency on the entire rendering stack.
  virtual void FillPasswordForm(
      const webkit::forms::PasswordFormFillData& form_data) = 0;

  // A mechanism to show an infobar in the current tab at our request.
  // The infobar may not show in some circumstances, such as when the one-click
  // sign in infobar is or will be shown.
  virtual void AddSavePasswordInfoBarIfPermitted(
      PasswordFormManager* form_to_save) = 0;

  // Get the profile for which we are managing passwords.
  virtual Profile* GetProfileForPasswordManager() = 0;

  // If any SSL certificate errors were encountered as a result of the last
  // page load.
  virtual bool DidLastPageLoadEncounterSSLErrors() = 0;

 private:
  DISALLOW_COPY_AND_ASSIGN(PasswordManagerDelegate);
};


#endif  // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_