Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / password_manager_internals / password_manager_internals_ui.h
index a2e62a2..c73486a 100644 (file)
@@ -6,14 +6,21 @@
 #define CHROME_BROWSER_UI_WEBUI_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_UI_H_
 
 #include "components/password_manager/core/browser/password_manager_logger.h"
+#include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_ui_controller.h"
 
-class PasswordManagerInternalsUI : public content::WebUIController,
-                                   public PasswordManagerLogger {
+class PasswordManagerInternalsUI
+    : public content::WebUIController,
+      public content::WebContentsObserver,
+      public password_manager::PasswordManagerLogger {
  public:
   explicit PasswordManagerInternalsUI(content::WebUI* web_ui);
   virtual ~PasswordManagerInternalsUI();
 
+  // WebContentsObserver implementation.
+  virtual void DidStopLoading(
+      content::RenderViewHost* render_view_host) OVERRIDE;
+
   // PasswordManagerLogger implementation.
   virtual void LogSavePasswordProgress(const std::string& text) OVERRIDE;
 
@@ -32,6 +39,17 @@ class PasswordManagerInternalsUI : public content::WebUIController,
   void NotifyAllPasswordManagerClients(
       ClientNotificationType notification_type);
 
+  // Helper used by LogSavePasswordProgress, actually sends |text| to the
+  // internals page.
+  void LogInternal(const std::string& text);
+
+  // Whether the observed WebContents did stop loading.
+  bool did_stop_loading_;
+
+  // Stores the logs here until |did_stop_loading_| becomes true. At that point
+  // all stored logs are displayed and any new are displayed directly.
+  std::string log_buffer_;
+
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerInternalsUI);
 };