Commit 1268fb74 authored by Sergio Villar Senin's avatar Sergio Villar Senin Committed by Commit Bot

Convert cloud_print/privet_notifications.cc to IdentityManager

It was using SigninManager API. Migrated to IdentityManager so it could
eventually make use of the identity service.

By the way, PrivetNotificationsFactory was lacking the dependency with
the SigninManagerFactory. Adding the new one with
IdentityManagerFactory instead.

BUG=890784

Change-Id: I0a3c3eb44ea28e8e388728b3e4e58841873057e4
Reviewed-on: https://chromium-review.googlesource.com/c/1278791
Commit-Queue: Sergio Villar <svillar@igalia.com>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599638}
parent be62008d
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "chrome/browser/printing/cloud_print/privet_device_lister_impl.h" #include "chrome/browser/printing/cloud_print/privet_device_lister_impl.h"
#include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h" #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
...@@ -34,12 +34,12 @@ ...@@ -34,12 +34,12 @@
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_controller.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "net/net_buildflags.h" #include "net/net_buildflags.h"
#include "services/identity/public/cpp/identity_manager.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
...@@ -307,11 +307,10 @@ void PrivetNotificationService::PrivetRemoveNotification() { ...@@ -307,11 +307,10 @@ void PrivetNotificationService::PrivetRemoveNotification() {
void PrivetNotificationService::Start() { void PrivetNotificationService::Start() {
#if defined(CHROMEOS) #if defined(CHROMEOS)
SigninManagerBase* signin_manager = auto* identity_manager = IdentityManagerFactory::GetForProfileIfExists(
SigninManagerFactory::GetForProfileIfExists( Profile::FromBrowserContext(profile_));
Profile::FromBrowserContext(profile_));
if (!signin_manager || !signin_manager->IsAuthenticated()) if (!identity_manager || !identity_manager->HasPrimaryAccount())
return; return;
#endif #endif
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/cloud_print/privet_notifications.h" #include "chrome/browser/printing/cloud_print/privet_notifications.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
namespace cloud_print { namespace cloud_print {
...@@ -19,6 +20,7 @@ PrivetNotificationServiceFactory::PrivetNotificationServiceFactory() ...@@ -19,6 +20,7 @@ PrivetNotificationServiceFactory::PrivetNotificationServiceFactory()
: BrowserContextKeyedServiceFactory( : BrowserContextKeyedServiceFactory(
"PrivetNotificationService", "PrivetNotificationService",
BrowserContextDependencyManager::GetInstance()) { BrowserContextDependencyManager::GetInstance()) {
DependsOn(IdentityManagerFactory::GetInstance());
} }
PrivetNotificationServiceFactory::~PrivetNotificationServiceFactory() { PrivetNotificationServiceFactory::~PrivetNotificationServiceFactory() {
......
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