OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_CORE_BROWSER_LOG_MANAGER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_MANAGER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 14 namespace password_manager { |
| 15 |
| 16 class LogRouter; |
| 17 |
| 18 // This interface is used by the password management code to receive and display |
| 19 // logs about progress of actions like saving a password. |
| 20 class LogManager { |
| 21 public: |
| 22 virtual ~LogManager() = default; |
| 23 |
| 24 // This method is called by a LogRouter, after the LogManager registers with |
| 25 // one. If |router_can_be_used| is true, logs can be sent to LogRouter after |
| 26 // the return from OnLogRouterAvailabilityChanged and will reach at least one |
| 27 // LogReceiver instance. If |router_can_be_used| is false, no logs should be |
| 28 // sent to the LogRouter. |
| 29 virtual void OnLogRouterAvailabilityChanged(bool router_can_be_used) = 0; |
| 30 |
| 31 // The owner of the LogManager can call this to start or end suspending the |
| 32 // logging, by setting |suspended| to true or false, respectively. |
| 33 virtual void SetSuspended(bool suspended) = 0; |
| 34 |
| 35 // Forward |text| for display to the LogRouter (if registered with one). |
| 36 virtual void LogSavePasswordProgress(const std::string& text) const = 0; |
| 37 |
| 38 // Returns true if logs recorded via LogSavePasswordProgress will be |
| 39 // displayed, and false otherwise. |
| 40 virtual bool IsLoggingActive() const = 0; |
| 41 |
| 42 // Returns the production code implementation of LogManager. If |log_router| |
| 43 // is null, the manager will do nothing. |notification_callback| will be |
| 44 // called every time the activity status of logging changes. |
| 45 static scoped_ptr<LogManager> Create(LogRouter* log_router, |
| 46 base::Closure notification_callback); |
| 47 }; |
| 48 |
| 49 } // namespace password_manager |
| 50 |
| 51 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_MANAGER_H_ |
OLD | NEW |