Commit 0833e896 authored by Glen Robertson's avatar Glen Robertson Committed by Commit Bot

Delete NOTIFICATION_PROFILE_DESTROYED.

This was only used in one test and is covered by an observer interface
method.
This cleans up a dependency from profile.cc on //c/b target towards
moving profile into its own target.

Bug: 268984,1149277
Change-Id: Ic12380f8175214da5ce6920172252178e3268126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550158
Commit-Queue: Glen Robertson <glenrob@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Auto-Submit: Glen Robertson <glenrob@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830073}
parent b51db0e8
...@@ -124,13 +124,6 @@ enum NotificationType { ...@@ -124,13 +124,6 @@ enum NotificationType {
// The details are none and the source is the new profile. // The details are none and the source is the new profile.
NOTIFICATION_PROFILE_ADDED, NOTIFICATION_PROFILE_ADDED,
// Use KeyedServiceShutdownNotifier instead this notification type (you did
// read the comment at the top of the file, didn't you?).
// Sent before a Profile is destroyed. This notification is sent both for
// normal and OTR profiles.
// The details are none and the source is a Profile*.
NOTIFICATION_PROFILE_DESTROYED,
// Printing ---------------------------------------------------------------- // Printing ----------------------------------------------------------------
// Notification from PrintJob that an event occurred. It can be that a page // Notification from PrintJob that an event occurred. It can be that a page
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/net/profile_network_context_service.h" #include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/profile_network_context_service_factory.h" #include "chrome/browser/net/profile_network_context_service_factory.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
...@@ -484,11 +483,6 @@ void Profile::MaybeSendDestroyedNotification() { ...@@ -484,11 +483,6 @@ void Profile::MaybeSendDestroyedNotification() {
for (auto& observer : observers_) for (auto& observer : observers_)
observer.OnProfileWillBeDestroyed(this); observer.OnProfileWillBeDestroyed(this);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_DESTROYED,
content::Source<Profile>(this),
content::NotificationService::NoDetails());
} }
} }
......
...@@ -504,9 +504,9 @@ class Profile : public content::BrowserContext { ...@@ -504,9 +504,9 @@ class Profile : public content::BrowserContext {
// This method is virtual in order to be overridden for tests. // This method is virtual in order to be overridden for tests.
virtual bool IsNewProfile() const; virtual bool IsNewProfile() const;
// Send NOTIFICATION_PROFILE_DESTROYED for this Profile, if it has not // Notify observers of |OnProfileWillBeDestroyed| for this profile, if it has
// already been sent. It is necessary because most Profiles are destroyed by // not already been called. It is necessary because most Profiles are
// ProfileDestroyer, but in tests, some are not. // destroyed by ProfileDestroyer, but in tests, some are not.
void MaybeSendDestroyedNotification(); void MaybeSendDestroyedNotification();
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
......
...@@ -755,13 +755,11 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, Notifications) { ...@@ -755,13 +755,11 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, Notifications) {
// Destroy the off-the-record profile. // Destroy the off-the-record profile.
{ {
content::WindowedNotificationObserver profile_destroyed_observer( ProfileDestructionWatcher watcher;
chrome::NOTIFICATION_PROFILE_DESTROYED, watcher.Watch(otr_profile);
content::Source<Profile>(otr_profile));
if (profile->HasPrimaryOTRProfile()) { if (profile->HasPrimaryOTRProfile()) {
profile->DestroyOffTheRecordProfile(profile->GetPrimaryOTRProfile()); profile->DestroyOffTheRecordProfile(profile->GetPrimaryOTRProfile());
profile_destroyed_observer.Wait(); watcher.WaitForDestruction();
} }
EXPECT_FALSE(profile->HasPrimaryOTRProfile()); EXPECT_FALSE(profile->HasPrimaryOTRProfile());
...@@ -769,12 +767,10 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, Notifications) { ...@@ -769,12 +767,10 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, Notifications) {
// Destroy the regular profile. // Destroy the regular profile.
{ {
content::WindowedNotificationObserver profile_destroyed_observer( ProfileDestructionWatcher watcher;
chrome::NOTIFICATION_PROFILE_DESTROYED, watcher.Watch(profile.get());
content::Source<Profile>(profile.get()));
profile.reset(); profile.reset();
profile_destroyed_observer.Wait(); watcher.WaitForDestruction();
} }
// Pending tasks related to |profile| could depend on |temp_dir|. We need to // Pending tasks related to |profile| could depend on |temp_dir|. We need to
......
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