Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3741)

Unified Diff: chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc

Issue 1228813006: Avoid creating PasswordsPrivateDelegate when shutting down. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review issues. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
index c37eadbea93e4c891abcf61832acb311ca254ad5..d22b7e1a370d5f4a63a9642463759aeff4028225 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
@@ -48,8 +48,10 @@ void PasswordsPrivateEventRouter::Shutdown() {
event_router_->UnregisterObserver(this);
PasswordsPrivateDelegate* delegate =
- PasswordsPrivateDelegateFactory::GetForBrowserContext(context_);
- delegate->RemoveObserver(this);
+ PasswordsPrivateDelegateFactory::GetForBrowserContext(context_,
+ false /* create */);
+ if (delegate)
+ delegate->RemoveObserver(this);
}
void PasswordsPrivateEventRouter::OnListenerAdded(
@@ -141,7 +143,8 @@ void PasswordsPrivateEventRouter::StartOrStopListeningForChanges() {
should_listen_for_plaintext_password_retrieval;
PasswordsPrivateDelegate* delegate =
- PasswordsPrivateDelegateFactory::GetForBrowserContext(context_);
+ PasswordsPrivateDelegateFactory::GetForBrowserContext(context_,
+ true /* create */);
if (should_listen && !listening_)
delegate->AddObserver(this);
else if (!should_listen && listening_)
« no previous file with comments | « chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698