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_AUTOFILL_CONTENT_RENDERER_RENDERER_SAVE_PASSWORD_PROGRESS_LOGGER_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_RENDERER_SAVE_PASSWORD_PROGRESS_LOGGER_H_
7 
8 #include <string>
9 
10 #include "base/macros.h"
11 #include "components/autofill/content/common/mojom/autofill_driver.mojom.h"
12 #include "components/autofill/core/common/save_password_progress_logger.h"
13 
14 namespace blink {
15 class WebFormControlElement;
16 }
17 
18 namespace autofill {
19 
20 // This is the SavePasswordProgressLogger specialization for the renderer code,
21 // which sends logs to the browser process over IPC.
22 class RendererSavePasswordProgressLogger : public SavePasswordProgressLogger {
23  public:
24   // The logger will use |password_manager_driver| to send logs to the browser.
25   // The |password_manager_driver| needs to outlive the constructed logger.
26   RendererSavePasswordProgressLogger(
27       mojom::PasswordManagerDriver* password_manager_driver);
28   ~RendererSavePasswordProgressLogger() override;
29 
30   void LogElementName(StringID label,
31                       const blink::WebFormControlElement& element);
32 
33  protected:
34   // SavePasswordProgressLogger:
35   void SendLog(const std::string& log) override;
36 
37  private:
38   // Used by SendLog to send the logs to the browser.
39   // |password_manager_driver_| needs to outlive the logger.
40   mojom::PasswordManagerDriver* password_manager_driver_;
41 
42   DISALLOW_COPY_AND_ASSIGN(RendererSavePasswordProgressLogger);
43 };
44 
45 }  // namespace autofill
46 
47 #endif  // COMPONENTS_AUTOFILL_CONTENT_RENDERER_RENDERER_SAVE_PASSWORD_PROGRESS_LOGGER_H_
48