Commit 5a7f9ab3 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Add method to unregister mailto: handler

The implementation of mailto: handler observes the SyncService
so it needs to unregister itself during shutdown. Add a method
called during application shutdown to unregister the handler.

Bug: 854159
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I99e6de4f488ef6ef0fe7cd7f48deece648051503
Reviewed-on: https://chromium-review.googlesource.com/1106161
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568789}
parent 5651a8f2
......@@ -958,6 +958,10 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[_mainCoordinator stop];
ios::GetChromeBrowserProvider()
->GetMailtoHandlerProvider()
->RemoveMailtoHandling();
_chromeMain.reset();
}
......@@ -1152,14 +1156,13 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
enqueueBlockNamed:kMailtoHandlingInitialization
block:^{
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
if (!strongSelf || !strongSelf->_mainBrowserState) {
return;
}
MailtoHandlerProvider* provider =
ios::GetChromeBrowserProvider()
->GetMailtoHandlerProvider();
provider->PrepareMailtoHandling(
strongSelf->_mainBrowserState);
ios::GetChromeBrowserProvider()
->GetMailtoHandlerProvider()
->PrepareMailtoHandling(
strongSelf->_mainBrowserState);
}];
}
}
......
......@@ -23,8 +23,11 @@ class MailtoHandlerProvider {
MailtoHandlerProvider();
virtual ~MailtoHandlerProvider();
// Set up mailto handling for the current browser state.
virtual void PrepareMailtoHandling(ios::ChromeBrowserState* browserState);
// Sets up mailto handling for |browser_state|.
virtual void PrepareMailtoHandling(ios::ChromeBrowserState* browser_state);
// Unregisters the mailto handler for browser state.
virtual void RemoveMailtoHandling();
// Deprecated: Set up mailto handling for the current user.
// The Signed-In Identity Block should return the primary signed in user.
......
......@@ -13,7 +13,9 @@ MailtoHandlerProvider::MailtoHandlerProvider() {}
MailtoHandlerProvider::~MailtoHandlerProvider() {}
void MailtoHandlerProvider::PrepareMailtoHandling(
ios::ChromeBrowserState* browserState) {}
ios::ChromeBrowserState* browser_state) {}
void MailtoHandlerProvider::RemoveMailtoHandling() {}
void MailtoHandlerProvider::PrepareMailtoHandling(
SignedInIdentityBlock signed_in_identity_block,
......
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