Commit e1ef5d09 authored by vabr@chromium.org's avatar vabr@chromium.org

Rename PasswordManagerLogger to LogReceiver

This CL introduces no semantic change, only renames PasswordManagerLogger
to LogReceiver, to better reflect the purpose of that interface.

BUG=347927

Review URL: https://codereview.chromium.org/264793010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272563 0039d316-1c4b-4281-b951-d872f2087c98
parent 43afaa6f
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#include "components/autofill/core/browser/password_generator.h" #include "components/autofill/core/browser/password_generator.h"
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "components/password_manager/content/browser/password_manager_internals_service_factory.h" #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
#include "components/password_manager/core/browser/log_receiver.h"
#include "components/password_manager/core/browser/password_form_manager.h" #include "components/password_manager/core/browser/password_form_manager.h"
#include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager.h"
#include "components/password_manager/core/browser/password_manager_internals_service.h" #include "components/password_manager/core/browser/password_manager_internals_service.h"
#include "components/password_manager/core/browser/password_manager_logger.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/common/password_manager_switches.h" #include "components/password_manager/core/common/password_manager_switches.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/autofill/content/common/autofill_messages.h" #include "components/autofill/content/common/autofill_messages.h"
#include "components/password_manager/content/browser/password_manager_internals_service_factory.h" #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
#include "components/password_manager/core/browser/log_receiver.h"
#include "components/password_manager/core/browser/password_manager_internals_service.h" #include "components/password_manager/core/browser/password_manager_internals_service.h"
#include "components/password_manager/core/browser/password_manager_logger.h"
#include "components/password_manager/core/common/password_manager_switches.h" #include "components/password_manager/core/common/password_manager_switches.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
...@@ -27,7 +27,7 @@ namespace { ...@@ -27,7 +27,7 @@ namespace {
const char kTestText[] = "abcd1234"; const char kTestText[] = "abcd1234";
class MockLogReceiver : public password_manager::PasswordManagerLogger { class MockLogReceiver : public password_manager::LogReceiver {
public: public:
MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&)); MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&));
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/password_manager/content/browser/password_manager_internals_service_factory.h" #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
#include "components/password_manager/core/browser/password_manager_logger.h" #include "components/password_manager/core/browser/log_receiver.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -18,7 +18,7 @@ namespace { ...@@ -18,7 +18,7 @@ namespace {
const char kTestText[] = "abcd1234"; const char kTestText[] = "abcd1234";
class MockLogReceiver : public password_manager::PasswordManagerLogger { class MockLogReceiver : public password_manager::LogReceiver {
public: public:
MockLogReceiver() {} MockLogReceiver() {}
......
...@@ -5,14 +5,13 @@ ...@@ -5,14 +5,13 @@
#ifndef CHROME_BROWSER_UI_WEBUI_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_UI_H_ #ifndef CHROME_BROWSER_UI_WEBUI_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_UI_H_ #define CHROME_BROWSER_UI_WEBUI_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_UI_H_
#include "components/password_manager/core/browser/password_manager_logger.h" #include "components/password_manager/core/browser/log_receiver.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_controller.h"
class PasswordManagerInternalsUI class PasswordManagerInternalsUI : public content::WebUIController,
: public content::WebUIController, public content::WebContentsObserver,
public content::WebContentsObserver, public password_manager::LogReceiver {
public password_manager::PasswordManagerLogger {
public: public:
explicit PasswordManagerInternalsUI(content::WebUI* web_ui); explicit PasswordManagerInternalsUI(content::WebUI* web_ui);
virtual ~PasswordManagerInternalsUI(); virtual ~PasswordManagerInternalsUI();
...@@ -21,7 +20,7 @@ class PasswordManagerInternalsUI ...@@ -21,7 +20,7 @@ class PasswordManagerInternalsUI
virtual void DidStopLoading( virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE; content::RenderViewHost* render_view_host) OVERRIDE;
// PasswordManagerLogger implementation. // LogReceiver implementation.
virtual void LogSavePasswordProgress(const std::string& text) OVERRIDE; virtual void LogSavePasswordProgress(const std::string& text) OVERRIDE;
private: private:
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
'sources': [ 'sources': [
'password_manager/core/browser/browser_save_password_progress_logger.cc', 'password_manager/core/browser/browser_save_password_progress_logger.cc',
'password_manager/core/browser/browser_save_password_progress_logger.h', 'password_manager/core/browser/browser_save_password_progress_logger.h',
'password_manager/core/browser/log_receiver.h',
'password_manager/core/browser/log_router.cc', 'password_manager/core/browser/log_router.cc',
'password_manager/core/browser/log_router.h', 'password_manager/core/browser/log_router.h',
'password_manager/core/browser/login_database.cc', 'password_manager/core/browser/login_database.cc',
...@@ -44,7 +45,6 @@ ...@@ -44,7 +45,6 @@
'password_manager/core/browser/password_manager_driver.h', 'password_manager/core/browser/password_manager_driver.h',
'password_manager/core/browser/password_manager_internals_service.cc', 'password_manager/core/browser/password_manager_internals_service.cc',
'password_manager/core/browser/password_manager_internals_service.h', 'password_manager/core/browser/password_manager_internals_service.h',
'password_manager/core/browser/password_manager_logger.h',
'password_manager/core/browser/password_manager_metrics_util.cc', 'password_manager/core/browser/password_manager_metrics_util.cc',
'password_manager/core/browser/password_manager_metrics_util.h', 'password_manager/core/browser/password_manager_metrics_util.h',
'password_manager/core/browser/password_store.cc', 'password_manager/core/browser/password_store.cc',
......
...@@ -2,27 +2,27 @@ ...@@ -2,27 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_LOGGER_H_ #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_RECEIVER_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_LOGGER_H_ #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_RECEIVER_H_
#include <string> #include <string>
#include "base/macros.h" #include "base/macros.h"
namespace password_manager { namespace password_manager {
// This interface is used by the password management code to report on progress // This interface is used by the password management code to receive and display
// of actions like saving a password. // logs about progress of actions like saving a password.
class PasswordManagerLogger { class LogReceiver {
public: public:
PasswordManagerLogger() {} LogReceiver() {}
virtual ~PasswordManagerLogger() {} virtual ~LogReceiver() {}
virtual void LogSavePasswordProgress(const std::string& text) = 0; virtual void LogSavePasswordProgress(const std::string& text) = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(PasswordManagerLogger); DISALLOW_COPY_AND_ASSIGN(LogReceiver);
}; };
} // namespace password_manager } // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_LOGGER_H_ #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_RECEIVER_H_
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "components/password_manager/core/browser/log_router.h" #include "components/password_manager/core/browser/log_router.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "components/password_manager/core/browser/log_receiver.h"
#include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_client.h"
#include "components/password_manager/core/browser/password_manager_logger.h"
namespace password_manager { namespace password_manager {
...@@ -22,7 +22,7 @@ void LogRouter::ProcessLog(const std::string& text) { ...@@ -22,7 +22,7 @@ void LogRouter::ProcessLog(const std::string& text) {
DCHECK(receivers_.might_have_observers()); DCHECK(receivers_.might_have_observers());
accumulated_logs_.append(text); accumulated_logs_.append(text);
FOR_EACH_OBSERVER( FOR_EACH_OBSERVER(
PasswordManagerLogger, receivers_, LogSavePasswordProgress(text)); LogReceiver, receivers_, LogSavePasswordProgress(text));
} }
bool LogRouter::RegisterClient(PasswordManagerClient* client) { bool LogRouter::RegisterClient(PasswordManagerClient* client) {
...@@ -36,7 +36,7 @@ void LogRouter::UnregisterClient(PasswordManagerClient* client) { ...@@ -36,7 +36,7 @@ void LogRouter::UnregisterClient(PasswordManagerClient* client) {
clients_.RemoveObserver(client); clients_.RemoveObserver(client);
} }
std::string LogRouter::RegisterReceiver(PasswordManagerLogger* receiver) { std::string LogRouter::RegisterReceiver(LogReceiver* receiver) {
DCHECK(receiver); DCHECK(receiver);
DCHECK(accumulated_logs_.empty() || receivers_.might_have_observers()); DCHECK(accumulated_logs_.empty() || receivers_.might_have_observers());
...@@ -48,7 +48,7 @@ std::string LogRouter::RegisterReceiver(PasswordManagerLogger* receiver) { ...@@ -48,7 +48,7 @@ std::string LogRouter::RegisterReceiver(PasswordManagerLogger* receiver) {
return accumulated_logs_; return accumulated_logs_;
} }
void LogRouter::UnregisterReceiver(PasswordManagerLogger* receiver) { void LogRouter::UnregisterReceiver(LogReceiver* receiver) {
DCHECK(receivers_.HasObserver(receiver)); DCHECK(receivers_.HasObserver(receiver));
receivers_.RemoveObserver(receiver); receivers_.RemoveObserver(receiver);
if (!receivers_.might_have_observers()) { if (!receivers_.might_have_observers()) {
......
...@@ -13,16 +13,13 @@ ...@@ -13,16 +13,13 @@
namespace password_manager { namespace password_manager {
class LogReceiver;
class PasswordManagerClient; class PasswordManagerClient;
class PasswordManagerLogger;
// The router stands between PasswordManagerClient instances and log receivers. // The router stands between PasswordManagerClient instances and log receivers.
// During the process of saving a password, the password manager code generates // During the process of saving a password, the password manager code generates
// the log strings, and passes them to the router. The router distributes the // the log strings, and passes them to the router. The router distributes the
// logs to the receivers for displaying. // logs to the receivers for displaying.
//
// TODO(vabr): The receivers are objects of type PasswordManagerLogger. That
// type should be renamed to LogReceiver instead.
class LogRouter { class LogRouter {
public: public:
LogRouter(); LogRouter();
...@@ -46,16 +43,16 @@ class LogRouter { ...@@ -46,16 +43,16 @@ class LogRouter {
// RegisterReceiver adds |receiver| to the right observer list, and returns // RegisterReceiver adds |receiver| to the right observer list, and returns
// the logs accumulated so far. (It returns by value, not const ref, to // the logs accumulated so far. (It returns by value, not const ref, to
// provide a snapshot as opposed to a link to |accumulated_logs_|.) // provide a snapshot as opposed to a link to |accumulated_logs_|.)
std::string RegisterReceiver(PasswordManagerLogger* receiver); std::string RegisterReceiver(LogReceiver* receiver);
// Remove |receiver| from the observers list. // Remove |receiver| from the observers list.
void UnregisterReceiver(PasswordManagerLogger* receiver); void UnregisterReceiver(LogReceiver* receiver);
private: private:
// Observer lists for clients and receivers. The |true| in the template // Observer lists for clients and receivers. The |true| in the template
// specialisation means that they will check that all observers were removed // specialisation means that they will check that all observers were removed
// on destruction. // on destruction.
ObserverList<PasswordManagerClient, true> clients_; ObserverList<PasswordManagerClient, true> clients_;
ObserverList<PasswordManagerLogger, true> receivers_; ObserverList<LogReceiver, true> receivers_;
// Logs accumulated since the first receiver was registered. // Logs accumulated since the first receiver was registered.
std::string accumulated_logs_; std::string accumulated_logs_;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "components/password_manager/core/browser/log_router.h" #include "components/password_manager/core/browser/log_router.h"
#include "components/password_manager/core/browser/password_manager_logger.h" #include "components/password_manager/core/browser/log_receiver.h"
#include "components/password_manager/core/browser/stub_password_manager_client.h" #include "components/password_manager/core/browser/stub_password_manager_client.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -17,7 +17,7 @@ namespace { ...@@ -17,7 +17,7 @@ namespace {
const char kTestText[] = "abcd1234"; const char kTestText[] = "abcd1234";
class MockLogReceiver : public PasswordManagerLogger { class MockLogReceiver : public LogReceiver {
public: public:
MockLogReceiver() {} MockLogReceiver() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment