content_password_manager_driver.h revision cedac228d2dd51db4b79ea1e72c7f249408ee061
1// Copyright 2014 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#ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRIVER_H_
6#define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRIVER_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "components/password_manager/core/browser/password_autofill_manager.h"
11#include "components/password_manager/core/browser/password_generation_manager.h"
12#include "components/password_manager/core/browser/password_manager.h"
13#include "components/password_manager/core/browser/password_manager_driver.h"
14#include "content/public/browser/web_contents_observer.h"
15
16namespace autofill {
17class AutofillManager;
18struct PasswordForm;
19}
20
21namespace content {
22class WebContents;
23}
24
25namespace password_manager {
26
27class ContentPasswordManagerDriver : public PasswordManagerDriver,
28                                     public content::WebContentsObserver {
29 public:
30  ContentPasswordManagerDriver(
31      content::WebContents* web_contents,
32      PasswordManagerClient* client,
33      autofill::AutofillManagerDelegate* autofill_manager_delegate);
34  virtual ~ContentPasswordManagerDriver();
35
36  // PasswordManagerDriver implementation.
37  virtual void FillPasswordForm(const autofill::PasswordFormFillData& form_data)
38      OVERRIDE;
39  virtual bool DidLastPageLoadEncounterSSLErrors() OVERRIDE;
40  virtual bool IsOffTheRecord() OVERRIDE;
41  virtual void AllowPasswordGenerationForForm(autofill::PasswordForm* form)
42      OVERRIDE;
43  virtual void AccountCreationFormsFound(
44      const std::vector<autofill::FormData>& forms) OVERRIDE;
45  virtual void FillSuggestion(const base::string16& username,
46                              const base::string16& password) OVERRIDE;
47  virtual void PreviewSuggestion(const base::string16& username,
48                                 const base::string16& password) OVERRIDE;
49  virtual void ClearPreviewedForm() OVERRIDE;
50
51  virtual PasswordGenerationManager* GetPasswordGenerationManager() OVERRIDE;
52  virtual PasswordManager* GetPasswordManager() OVERRIDE;
53  virtual autofill::AutofillManager* GetAutofillManager() OVERRIDE;
54  virtual PasswordAutofillManager* GetPasswordAutofillManager() OVERRIDE;
55
56  // content::WebContentsObserver overrides.
57  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
58  virtual void DidNavigateMainFrame(
59      const content::LoadCommittedDetails& details,
60      const content::FrameNavigateParams& params) OVERRIDE;
61
62 private:
63  PasswordManager password_manager_;
64  PasswordGenerationManager password_generation_manager_;
65  PasswordAutofillManager password_autofill_manager_;
66
67  DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver);
68};
69
70}  // namespace password_manager
71
72#endif  // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRIVER_H_
73