Commit 05c32ab7 authored by Mario Sanchez Prada's avatar Mario Sanchez Prada Committed by Commit Bot

[ios] Migrate ClearBrowsingDataManager to the IdentityManager

Use identity::IdentityManager::HasPrimaryAccount() instead of
SigninManagerBase::IsAuthenticated, and remove unneeded includes.

Bug: 890826
Change-Id: Iabe09231fa684e8249475ba9dcd8782d7ecd90d5
Reviewed-on: https://chromium-review.googlesource.com/c/1315969Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#605735}
parent 2712c58b
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "components/google/core/common/google_util.h" #include "components/google/core/common/google_util.h"
#include "components/history/core/browser/web_history_service.h" #include "components/history/core/browser/web_history_service.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
...@@ -26,7 +25,7 @@ ...@@ -26,7 +25,7 @@
#include "ios/chrome/browser/experimental_flags.h" #include "ios/chrome/browser/experimental_flags.h"
#include "ios/chrome/browser/feature_engagement/tracker_factory.h" #include "ios/chrome/browser/feature_engagement/tracker_factory.h"
#include "ios/chrome/browser/history/web_history_service_factory.h" #include "ios/chrome/browser/history/web_history_service_factory.h"
#include "ios/chrome/browser/signin/signin_manager_factory.h" #include "ios/chrome/browser/signin/identity_manager_factory.h"
#include "ios/chrome/browser/sync/profile_sync_service_factory.h" #include "ios/chrome/browser/sync/profile_sync_service_factory.h"
#import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h"
...@@ -50,6 +49,7 @@ ...@@ -50,6 +49,7 @@
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/public/provider/chrome/browser/images/branded_image_provider.h" #import "ios/public/provider/chrome/browser/images/branded_image_provider.h"
#include "services/identity/public/cpp/identity_manager.h"
#include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -264,9 +264,9 @@ actionSheetCoordinatorWithDataTypesToRemove: ...@@ -264,9 +264,9 @@ actionSheetCoordinatorWithDataTypesToRemove:
// Add footers about user's account data. // Add footers about user's account data.
- (void)addSyncProfileItemsToModel:(ListModel*)model { - (void)addSyncProfileItemsToModel:(ListModel*)model {
// Google Account footer. // Google Account footer.
SigninManager* signinManager = identity::IdentityManager* identityManager =
ios::SigninManagerFactory::GetForBrowserState(self.browserState); IdentityManagerFactory::GetForBrowserState(self.browserState);
if (signinManager->IsAuthenticated()) { if (identityManager->HasPrimaryAccount()) {
// TODO(crbug.com/650424): Footer items must currently go into a separate // TODO(crbug.com/650424): Footer items must currently go into a separate
// section, to work around a drawing bug in MDC. // section, to work around a drawing bug in MDC.
[model addSectionWithIdentifier:SectionIdentifierGoogleAccount]; [model addSectionWithIdentifier:SectionIdentifierGoogleAccount];
...@@ -291,7 +291,7 @@ actionSheetCoordinatorWithDataTypesToRemove: ...@@ -291,7 +291,7 @@ actionSheetCoordinatorWithDataTypesToRemove:
} }
// If not signed in, no need to continue with profile syncing. // If not signed in, no need to continue with profile syncing.
if (!signinManager->IsAuthenticated()) { if (!identityManager->HasPrimaryAccount()) {
return; return;
} }
...@@ -595,9 +595,9 @@ actionSheetCoordinatorWithDataTypesToRemove: ...@@ -595,9 +595,9 @@ actionSheetCoordinatorWithDataTypesToRemove:
"History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated",
_shouldShowNoticeAboutOtherFormsOfBrowsingHistory); _shouldShowNoticeAboutOtherFormsOfBrowsingHistory);
SigninManager* signinManager = identity::IdentityManager* identityManager =
ios::SigninManagerFactory::GetForBrowserState(_browserState); IdentityManagerFactory::GetForBrowserState(_browserState);
if (!signinManager->IsAuthenticated()) { if (!identityManager->HasPrimaryAccount()) {
return; return;
} }
......
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