Update most ScopedObserver declarations in //chrome/browser
Bug: 998625
Change-Id: I239558c07ce10166b82a2b886ef08a1d4ede56f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817333
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Evan Stade <[email protected]>
Cr-Commit-Position: refs/heads/master@{#699035}
diff --git a/chrome/browser/apps/platform_apps/shortcut_manager.cc b/chrome/browser/apps/platform_apps/shortcut_manager.cc
index bf82f7d..c2e7b96 100644
--- a/chrome/browser/apps/platform_apps/shortcut_manager.cc
+++ b/chrome/browser/apps/platform_apps/shortcut_manager.cc
@@ -26,7 +26,6 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h"
@@ -72,9 +71,7 @@
}
AppShortcutManager::AppShortcutManager(Profile* profile)
- : profile_(profile),
- is_profile_attributes_storage_observer_(false),
- extension_registry_observer_(this) {
+ : profile_(profile), is_profile_attributes_storage_observer_(false) {
// Use of g_browser_process requires that we are either on the UI thread, or
// there are no threads initialized (such as in unit tests).
DCHECK(!content::BrowserThread::IsThreadInitialized(
diff --git a/chrome/browser/apps/platform_apps/shortcut_manager.h b/chrome/browser/apps/platform_apps/shortcut_manager.h
index d2583a0..fad39152 100644
--- a/chrome/browser/apps/platform_apps/shortcut_manager.h
+++ b/chrome/browser/apps/platform_apps/shortcut_manager.h
@@ -10,15 +10,12 @@
#include "base/scoped_observer.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension.h"
class Profile;
-namespace extensions {
-class ExtensionRegistry;
-}
-
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -60,7 +57,7 @@
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
base::WeakPtrFactory<AppShortcutManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/autocomplete/shortcuts_extensions_manager.cc b/chrome/browser/autocomplete/shortcuts_extensions_manager.cc
index 51a01b7..5f6cf3a 100644
--- a/chrome/browser/autocomplete/shortcuts_extensions_manager.cc
+++ b/chrome/browser/autocomplete/shortcuts_extensions_manager.cc
@@ -7,11 +7,10 @@
#include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/omnibox/browser/shortcuts_backend.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
ShortcutsExtensionsManager::ShortcutsExtensionsManager(Profile* profile)
- : registry_observer_(this), profile_(profile) {
+ : profile_(profile) {
DCHECK(profile_);
registry_observer_.Add(extensions::ExtensionRegistry::Get(profile_));
}
diff --git a/chrome/browser/autocomplete/shortcuts_extensions_manager.h b/chrome/browser/autocomplete/shortcuts_extensions_manager.h
index 4f60a5b..8f876d6 100644
--- a/chrome/browser/autocomplete/shortcuts_extensions_manager.h
+++ b/chrome/browser/autocomplete/shortcuts_extensions_manager.h
@@ -8,14 +8,11 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "base/supports_user_data.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
class Profile;
-namespace extensions {
-class ExtensionRegistry;
-}
-
// This class manages the removal of shortcuts associated with an extension when
// that extension is unloaded.
class ShortcutsExtensionsManager
@@ -34,7 +31,7 @@
private:
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- registry_observer_;
+ registry_observer_{this};
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager);
diff --git a/chrome/browser/banners/app_banner_manager_desktop.cc b/chrome/browser/banners/app_banner_manager_desktop.cc
index 1b55b61..3c5c5dd0 100644
--- a/chrome/browser/banners/app_banner_manager_desktop.cc
+++ b/chrome/browser/banners/app_banner_manager_desktop.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/web_applications/web_app_dialog_utils.h"
-#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_util.h"
@@ -55,7 +54,7 @@
AppBannerManagerDesktop::AppBannerManagerDesktop(
content::WebContents* web_contents)
- : AppBannerManager(web_contents), registrar_observer_(this) {
+ : AppBannerManager(web_contents) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
diff --git a/chrome/browser/banners/app_banner_manager_desktop.h b/chrome/browser/banners/app_banner_manager_desktop.h
index 0f5132b8..80ad977 100644
--- a/chrome/browser/banners/app_banner_manager_desktop.h
+++ b/chrome/browser/banners/app_banner_manager_desktop.h
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/banners/app_banner_manager.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/app_registrar_observer.h"
@@ -82,7 +83,7 @@
extensions::ExtensionRegistry* extension_registry_;
ScopedObserver<web_app::AppRegistrar, web_app::AppRegistrarObserver>
- registrar_observer_;
+ registrar_observer_{this};
base::WeakPtrFactory<AppBannerManagerDesktop> weak_factory_{this};
diff --git a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
index 8c237ea9..2b3b5a7c 100644
--- a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
+++ b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/common/buildflags.h"
-#include "components/history/core/browser/history_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
@@ -18,7 +17,7 @@
BrowsingDataHistoryObserverService::BrowsingDataHistoryObserverService(
Profile* profile)
- : profile_(profile), history_observer_(this) {
+ : profile_(profile) {
auto* history_service = HistoryServiceFactory::GetForProfile(
profile, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service)
diff --git a/chrome/browser/browsing_data/browsing_data_history_observer_service.h b/chrome/browser/browsing_data/browsing_data_history_observer_service.h
index 75b0167..f96f9590 100644
--- a/chrome/browser/browsing_data/browsing_data_history_observer_service.h
+++ b/chrome/browser/browsing_data/browsing_data_history_observer_service.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HISTORY_OBSERVER_SERVICE_H_
#include "base/scoped_observer.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -50,7 +51,7 @@
Profile* profile_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_observer_;
+ history_observer_{this};
DISALLOW_COPY_AND_ASSIGN(BrowsingDataHistoryObserverService);
};
diff --git a/chrome/browser/content_settings/sound_content_setting_observer.cc b/chrome/browser/content_settings/sound_content_setting_observer.cc
index 101c0f48..67de4ba4 100644
--- a/chrome/browser/content_settings/sound_content_setting_observer.cc
+++ b/chrome/browser/content_settings/sound_content_setting_observer.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
@@ -29,9 +28,7 @@
SoundContentSettingObserver::SoundContentSettingObserver(
content::WebContents* contents)
- : content::WebContentsObserver(contents),
- logged_site_muted_ukm_(false),
- observer_(this) {
+ : content::WebContentsObserver(contents), logged_site_muted_ukm_(false) {
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
host_content_settings_map_ =
diff --git a/chrome/browser/content_settings/sound_content_setting_observer.h b/chrome/browser/content_settings/sound_content_setting_observer.h
index d9998d4..0844f68 100644
--- a/chrome/browser/content_settings/sound_content_setting_observer.h
+++ b/chrome/browser/content_settings/sound_content_setting_observer.h
@@ -8,13 +8,12 @@
#include "base/scoped_observer.h"
#include "build/build_config.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
-class HostContentSettingsMap;
-
class SoundContentSettingObserver
: public content::WebContentsObserver,
public content::WebContentsUserData<SoundContentSettingObserver>,
@@ -72,7 +71,8 @@
HostContentSettingsMap* host_content_settings_map_;
- ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
+ ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_{
+ this};
WEB_CONTENTS_USER_DATA_KEY_DECL();
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index f775ad2..1071597 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -34,7 +34,6 @@
#include "components/content_settings/core/browser/content_settings_info.h"
#include "components/content_settings/core/browser/content_settings_registry.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
@@ -112,8 +111,7 @@
previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()),
pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT),
load_plugins_link_enabled_(true),
- microphone_camera_state_(MICROPHONE_CAMERA_NOT_ACCESSED),
- observer_(this) {
+ microphone_camera_state_(MICROPHONE_CAMERA_NOT_ACCESSED) {
ClearContentSettingsExceptForNavigationRelatedSettings();
ClearNavigationRelatedContentSettings();
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h
index 95277f2..aa45d1e 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.h
+++ b/chrome/browser/content_settings/tab_specific_content_settings.h
@@ -21,14 +21,13 @@
#include "chrome/common/custom_handlers/protocol_handler.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
#include "components/content_settings/core/browser/content_settings_usages_state.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "net/cookies/canonical_cookie.h"
-class HostContentSettingsMap;
-
namespace content {
class NavigationHandle;
}
@@ -453,7 +452,8 @@
std::string media_stream_requested_video_device_;
// Observer to watch for content settings changed.
- ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
+ ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_{
+ this};
// Stores content settings changed by the user via page info since the last
// navigation. Used to determine whether to display the settings in page info.
diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
index d0a0e209..d319114 100644
--- a/chrome/browser/download/download_request_limiter.cc
+++ b/chrome/browser/download/download_request_limiter.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "components/content_settings/core/browser/content_settings_details.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -104,8 +103,7 @@
ui_status_(DownloadRequestLimiter::DOWNLOAD_UI_DEFAULT),
origin_(url::Origin::Create(contents->GetVisibleURL())),
download_count_(0),
- download_seen_(false),
- observer_(this) {
+ download_seen_(false) {
observer_.Add(GetContentSettings(contents));
NavigationEntry* last_entry =
contents->GetController().GetLastCommittedEntry();
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h
index 90285fb..21e945f2 100644
--- a/chrome/browser/download/download_request_limiter.h
+++ b/chrome/browser/download/download_request_limiter.h
@@ -19,13 +19,12 @@
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "url/origin.h"
-class HostContentSettingsMap;
-
namespace content {
class WebContents;
}
@@ -215,7 +214,7 @@
DownloadStatusMap download_status_map_;
ScopedObserver<HostContentSettingsMap, content_settings::Observer>
- observer_;
+ observer_{this};
// Weak pointer factory for generating a weak pointer to pass to the
// infobar. User responses to the throttling prompt will be returned
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index e005ae13..b0c787ca 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -30,7 +30,6 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
@@ -150,8 +149,7 @@
select_file_dialog_(),
select_file_types_(),
dialog_type_(ui::SelectFileDialog::SELECT_OPEN_FILE),
- dialog_mode_(FileChooserParams::Mode::kOpen),
- observer_(this) {}
+ dialog_mode_(FileChooserParams::Mode::kOpen) {}
FileSelectHelper::~FileSelectHelper() {
// There may be pending file dialogs, we need to tell them that we've gone
diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h
index e02b4da..12cb2f9 100644
--- a/chrome/browser/file_select_helper.h
+++ b/chrome/browser/file_select_helper.h
@@ -16,6 +16,7 @@
#include "build/build_config.h"
#include "components/safe_browsing/buildflags.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/base/directory_lister.h"
@@ -241,7 +242,7 @@
std::unique_ptr<ActiveDirectoryEnumeration> directory_enumeration_;
ScopedObserver<content::RenderWidgetHost, content::RenderWidgetHostObserver>
- observer_;
+ observer_{this};
// Temporary files only used on OSX. This class is responsible for deleting
// these files when they are no longer needed.
diff --git a/chrome/browser/metrics/browser_window_histogram_helper.cc b/chrome/browser/metrics/browser_window_histogram_helper.cc
index 86e17c3..b37677f 100644
--- a/chrome/browser/metrics/browser_window_histogram_helper.cc
+++ b/chrome/browser/metrics/browser_window_histogram_helper.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/metrics/browser_window_histogram_helper.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
-#include "ui/compositor/compositor.h"
BrowserWindowHistogramHelper::~BrowserWindowHistogramHelper() {}
@@ -24,8 +23,7 @@
}
BrowserWindowHistogramHelper::BrowserWindowHistogramHelper(
- ui::Compositor* compositor)
- : scoped_observer_(this) {
+ ui::Compositor* compositor) {
startup_metric_utils::RecordBrowserWindowFirstPaint(base::TimeTicks::Now());
#if defined(OS_MACOSX)
diff --git a/chrome/browser/metrics/browser_window_histogram_helper.h b/chrome/browser/metrics/browser_window_histogram_helper.h
index c0bd5aac..648f3823 100644
--- a/chrome/browser/metrics/browser_window_histogram_helper.h
+++ b/chrome/browser/metrics/browser_window_histogram_helper.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
+#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_observer.h"
// Class that encapsulates logic of recording
@@ -37,7 +38,7 @@
void OnCompositingEnded(ui::Compositor* compositor) override;
void OnCompositingShuttingDown(ui::Compositor* compositor) override;
- ScopedObserver<ui::Compositor, ui::CompositorObserver> scoped_observer_;
+ ScopedObserver<ui::Compositor, ui::CompositorObserver> scoped_observer_{this};
DISALLOW_COPY_AND_ASSIGN(BrowserWindowHistogramHelper);
};
diff --git a/chrome/browser/metrics/subprocess_metrics_provider.cc b/chrome/browser/metrics/subprocess_metrics_provider.cc
index e966058..c41867f4 100644
--- a/chrome/browser/metrics/subprocess_metrics_provider.cc
+++ b/chrome/browser/metrics/subprocess_metrics_provider.cc
@@ -20,7 +20,6 @@
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_process_host.h"
namespace {
@@ -30,8 +29,7 @@
} // namespace
-SubprocessMetricsProvider::SubprocessMetricsProvider()
- : scoped_observer_(this) {
+SubprocessMetricsProvider::SubprocessMetricsProvider() {
base::StatisticsRecorder::RegisterHistogramProvider(
weak_ptr_factory_.GetWeakPtr());
content::BrowserChildProcessObserver::Add(this);
diff --git a/chrome/browser/metrics/subprocess_metrics_provider.h b/chrome/browser/metrics/subprocess_metrics_provider.h
index b995346..4401c69 100644
--- a/chrome/browser/metrics/subprocess_metrics_provider.h
+++ b/chrome/browser/metrics/subprocess_metrics_provider.h
@@ -8,8 +8,8 @@
#include <memory>
#include <set>
-#include "base/gtest_prod_util.h"
#include "base/containers/id_map.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/statistics_recorder.h"
#include "base/scoped_observer.h"
@@ -18,6 +18,7 @@
#include "content/public/browser/browser_child_process_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_process_host_observer.h"
namespace base {
@@ -105,8 +106,8 @@
AllocatorByIdMap allocators_by_id_;
// Track all observed render processes to un-observe them on exit.
- ScopedObserver<content::RenderProcessHost, SubprocessMetricsProvider>
- scoped_observer_;
+ ScopedObserver<content::RenderProcessHost, content::RenderProcessHostObserver>
+ scoped_observer_{this};
base::WeakPtrFactory<SubprocessMetricsProvider> weak_ptr_factory_{this};
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc
index a0dd2bd1..8861d30 100644
--- a/chrome/browser/net/profile_network_context_service.cc
+++ b/chrome/browser/net/profile_network_context_service.cc
@@ -31,7 +31,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/certificate_transparency/pref_names.h"
-#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/language/core/browser/pref_names.h"
@@ -129,9 +128,7 @@
} // namespace
ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile)
- : profile_(profile),
- proxy_config_monitor_(profile),
- cookie_settings_observer_(this) {
+ : profile_(profile), proxy_config_monitor_(profile) {
PrefService* profile_prefs = profile->GetPrefs();
quic_allowed_.Init(
prefs::kQuicAllowed, profile_prefs,
diff --git a/chrome/browser/net/profile_network_context_service.h b/chrome/browser/net/profile_network_context_service.h
index ad43b67..6ebf38e 100644
--- a/chrome/browser/net/profile_network_context_service.h
+++ b/chrome/browser/net/profile_network_context_service.h
@@ -132,8 +132,9 @@
PrefChangeRegistrar pref_change_registrar_;
scoped_refptr<content_settings::CookieSettings> cookie_settings_;
- ScopedObserver<content_settings::CookieSettings, ProfileNetworkContextService>
- cookie_settings_observer_;
+ ScopedObserver<content_settings::CookieSettings,
+ content_settings::CookieSettings::Observer>
+ cookie_settings_observer_{this};
// Used to post schedule CT policy updates
base::OneShotTimer ct_policy_update_timer_;
diff --git a/chrome/browser/notifications/notification_system_observer.cc b/chrome/browser/notifications/notification_system_observer.cc
index 48cf5ca9..a2e7ef8f 100644
--- a/chrome/browser/notifications/notification_system_observer.cc
+++ b/chrome/browser/notifications/notification_system_observer.cc
@@ -11,12 +11,11 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "content/public/browser/notification_service.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
NotificationSystemObserver::NotificationSystemObserver(
NotificationUIManager* ui_manager)
- : ui_manager_(ui_manager), extension_registry_observer_(this) {
+ : ui_manager_(ui_manager) {
DCHECK(ui_manager_);
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
diff --git a/chrome/browser/notifications/notification_system_observer.h b/chrome/browser/notifications/notification_system_observer.h
index f206c37..fc6319b 100644
--- a/chrome/browser/notifications/notification_system_observer.h
+++ b/chrome/browser/notifications/notification_system_observer.h
@@ -9,16 +9,13 @@
#include "base/scoped_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
namespace content {
class BrowserContext;
}
-namespace extensions {
-class ExtensionRegistry;
-}
-
class NotificationUIManager;
// The content::NotificationObserver observes system status change and sends
@@ -49,7 +46,7 @@
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(NotificationSystemObserver);
};
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc
index 2e1391a..cb7d23a 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc
@@ -25,7 +25,6 @@
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/prerender/prerender_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/in_memory_database.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_result.h"
@@ -74,8 +73,7 @@
: profile_(profile),
main_profile_predictor_(NULL),
incognito_predictor_(NULL),
- initialized_(false),
- history_service_observer_(this) {
+ initialized_(false) {
if (profile_->IsOffTheRecord()) {
main_profile_predictor_ = AutocompleteActionPredictorFactory::GetForProfile(
profile_->GetOriginalProfile());
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.h b/chrome/browser/predictors/autocomplete_action_predictor.h
index 085a6677..fbaffeb 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.h
+++ b/chrome/browser/predictors/autocomplete_action_predictor.h
@@ -18,6 +18,7 @@
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/predictors/autocomplete_action_predictor_table.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/browser/history_types.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -40,7 +41,6 @@
}
namespace history {
-class HistoryService;
class URLDatabase;
}
@@ -280,7 +280,7 @@
bool initialized_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_service_observer_;
+ history_service_observer_{this};
DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor);
};
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index 451e0e7..1ccbca4 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/predictors/predictors_features.h"
#include "chrome/browser/profiles/profile.h"
#include "components/history/core/browser/history_database.h"
-#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/url_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -223,8 +222,7 @@
config_(config),
initialization_state_(NOT_INITIALIZED),
tables_(PredictorDatabaseFactory::GetForProfile(profile)
- ->resource_prefetch_tables()),
- history_service_observer_(this) {
+ ->resource_prefetch_tables()) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h
index d05c0246..09a8d0ed 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.h
+++ b/chrome/browser/predictors/resource_prefetch_predictor.h
@@ -25,6 +25,7 @@
#include "chrome/browser/predictors/navigation_id.h"
#include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
#include "components/history/core/browser/history_db_task.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/browser/history_types.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -276,7 +277,7 @@
std::unique_ptr<OriginDataMap> origin_data_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_service_observer_;
+ history_service_observer_{this};
// Indicates if all predictors data should be deleted after the
// initialization is completed.
diff --git a/chrome/browser/resource_coordinator/local_site_characteristics_data_store.cc b/chrome/browser/resource_coordinator/local_site_characteristics_data_store.cc
index 735c183..4db5771 100644
--- a/chrome/browser/resource_coordinator/local_site_characteristics_data_store.cc
+++ b/chrome/browser/resource_coordinator/local_site_characteristics_data_store.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/resource_coordinator/local_site_characteristics_data_reader.h"
#include "chrome/browser/resource_coordinator/local_site_characteristics_data_writer.h"
#include "chrome/browser/resource_coordinator/tab_manager_features.h"
-#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/url_row.h"
#include "url/gurl.h"
@@ -35,7 +34,7 @@
LocalSiteCharacteristicsDataStore::LocalSiteCharacteristicsDataStore(
Profile* profile)
- : history_observer_(this), profile_(profile) {
+ : profile_(profile) {
DCHECK(base::FeatureList::IsEnabled(features::kSiteCharacteristicsDatabase));
database_ = std::make_unique<LevelDBSiteCharacteristicsDatabase>(
diff --git a/chrome/browser/resource_coordinator/local_site_characteristics_data_store.h b/chrome/browser/resource_coordinator/local_site_characteristics_data_store.h
index 913a82f6..de68f331 100644
--- a/chrome/browser/resource_coordinator/local_site_characteristics_data_store.h
+++ b/chrome/browser/resource_coordinator/local_site_characteristics_data_store.h
@@ -14,6 +14,7 @@
#include "chrome/browser/resource_coordinator/local_site_characteristics_data_store_inspector.h"
#include "chrome/browser/resource_coordinator/site_characteristics_data_store.h"
#include "chrome/browser/resource_coordinator/site_characteristics_data_writer.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
class Profile;
@@ -97,8 +98,8 @@
// pointer.
LocalSiteCharacteristicsMap origin_data_map_;
- ScopedObserver<history::HistoryService, LocalSiteCharacteristicsDataStore>
- history_observer_;
+ ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
+ history_observer_{this};
std::unique_ptr<LocalSiteCharacteristicsDatabase> database_;
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
index 9f4ea6a..1270337 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
@@ -26,7 +26,6 @@
#include "chrome/common/safe_browsing/download_type_util.h"
#include "chrome/common/safe_browsing/file_type_policies.h"
#include "components/history/core/browser/download_constants.h"
-#include "components/history/core/browser/history_service.h"
#include "components/language/core/browser/pref_names.h"
#include "components/language/core/common/locale_util.h"
#include "components/prefs/pref_service.h"
@@ -257,15 +256,13 @@
return finder;
}
-LastDownloadFinder::LastDownloadFinder() : history_service_observer_(this) {}
+LastDownloadFinder::LastDownloadFinder() = default;
LastDownloadFinder::LastDownloadFinder(
const DownloadDetailsGetter& download_details_getter,
const std::vector<Profile*>& profiles,
const LastDownloadCallback& callback)
- : download_details_getter_(download_details_getter),
- callback_(callback),
- history_service_observer_(this) {
+ : download_details_getter_(download_details_getter), callback_(callback) {
// Observe profile lifecycle events so that the finder can begin or abandon
// the search in profiles while it is running.
notification_registrar_.Add(this,
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
index bf06622..9b19395 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
@@ -16,6 +16,7 @@
#include "base/scoped_observer.h"
#include "chrome/browser/safe_browsing/incident_reporting/download_metadata_manager.h"
#include "components/history/core/browser/download_row.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -27,10 +28,6 @@
class NotificationSource;
}
-namespace history {
-class HistoryService;
-}
-
namespace safe_browsing {
class ClientIncidentReport_DownloadDetails;
@@ -149,7 +146,7 @@
// HistoryServiceObserver
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_service_observer_;
+ history_service_observer_{this};
// A factory for asynchronous operations on profiles' HistoryService.
base::WeakPtrFactory<LastDownloadFinder> weak_ptr_factory_{this};
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
index 20f17e9..8360f38 100644
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/page_info/page_info_ui.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -107,8 +106,7 @@
: content::WebContentsObserver(contents),
manager_(manager),
has_user_gesture_(false),
- last_user_gesture_timestamp_(base::Time()),
- content_settings_observer_(this) {
+ last_user_gesture_timestamp_(base::Time()) {
content_settings_observer_.Add(HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(web_contents()->GetBrowserContext())));
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h
index d3bcfbe0..45f3542 100644
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h
@@ -8,6 +8,7 @@
#include "base/scoped_observer.h"
#include "base/supports_user_data.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/safe_browsing/proto/csd.pb.h"
#include "components/sessions/core/session_id.h"
@@ -18,8 +19,6 @@
class NavigationHandle;
}
-class HostContentSettingsMap;
-
namespace safe_browsing {
class SafeBrowsingNavigationObserverManager;
@@ -159,7 +158,7 @@
base::Time last_user_gesture_timestamp_;
ScopedObserver<HostContentSettingsMap, content_settings::Observer>
- content_settings_observer_;
+ content_settings_observer_{this};
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserver);
};
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index c04aa723..49e945e 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/search/background/ntp_background_service.h"
#include "chrome/browser/search/background/ntp_background_service_factory.h"
#include "chrome/browser/search/chrome_colors/chrome_colors_service.h"
#include "chrome/browser/search/instant_io_context.h"
@@ -179,8 +178,6 @@
: profile_(profile),
most_visited_info_(std::make_unique<InstantMostVisitedInfo>()),
pref_service_(profile_->GetPrefs()),
- theme_observer_(this),
- background_service_observer_(this),
native_theme_(ui::NativeTheme::GetInstanceForNativeUi()),
background_updated_timestamp_(base::TimeTicks::Now()),
clock_(base::DefaultClock::GetInstance()) {
diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h
index 8bbfbf6..a2de87f 100644
--- a/chrome/browser/search/instant_service.h
+++ b/chrome/browser/search/instant_service.h
@@ -17,6 +17,7 @@
#include "base/observer_list.h"
#include "base/optional.h"
#include "build/build_config.h"
+#include "chrome/browser/search/background/ntp_background_service.h"
#include "chrome/browser/search/background/ntp_background_service_observer.h"
#include "chrome/browser/search/search_provider_observer.h"
#include "components/history/core/browser/history_types.h"
@@ -38,7 +39,6 @@
class InstantIOContext;
class InstantServiceObserver;
-class NtpBackgroundService;
class Profile;
struct CollectionImage;
struct InstantMostVisitedInfo;
@@ -314,10 +314,11 @@
PrefService* pref_service_;
- ScopedObserver<ui::NativeTheme, InstantService> theme_observer_;
+ ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> theme_observer_{
+ this};
ScopedObserver<NtpBackgroundService, NtpBackgroundServiceObserver>
- background_service_observer_;
+ background_service_observer_{this};
ui::NativeTheme* native_theme_;
diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc
index 1a7423b..0890a24 100644
--- a/chrome/browser/search/local_ntp_source.cc
+++ b/chrome/browser/search/local_ntp_source.cc
@@ -27,20 +27,17 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/background/ntp_background_data.h"
-#include "chrome/browser/search/background/ntp_background_service.h"
#include "chrome/browser/search/background/ntp_background_service_factory.h"
#include "chrome/browser/search/instant_io_context.h"
#include "chrome/browser/search/local_ntp_js_integrity.h"
#include "chrome/browser/search/ntp_features.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_data.h"
-#include "chrome/browser/search/one_google_bar/one_google_bar_service.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_service_factory.h"
#include "chrome/browser/search/promos/promo_data.h"
#include "chrome/browser/search/promos/promo_service.h"
#include "chrome/browser/search/promos/promo_service_factory.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/search/search_suggest/search_suggest_data.h"
-#include "chrome/browser/search/search_suggest/search_suggest_service.h"
#include "chrome/browser/search/search_suggest/search_suggest_service_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_provider_logos/logo_service_factory.h"
@@ -771,15 +768,11 @@
: profile_(profile),
ntp_background_service_(
NtpBackgroundServiceFactory::GetForProfile(profile_)),
- ntp_background_service_observer_(this),
one_google_bar_service_(
OneGoogleBarServiceFactory::GetForProfile(profile_)),
- one_google_bar_service_observer_(this),
promo_service_(PromoServiceFactory::GetForProfile(profile_)),
- promo_service_observer_(this),
search_suggest_service_(
SearchSuggestServiceFactory::GetForProfile(profile_)),
- search_suggest_service_observer_(this),
logo_service_(nullptr) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/chrome/browser/search/local_ntp_source.h b/chrome/browser/search/local_ntp_source.h
index 91c6264..ad6ecead 100644
--- a/chrome/browser/search/local_ntp_source.h
+++ b/chrome/browser/search/local_ntp_source.h
@@ -15,9 +15,13 @@
#include "base/scoped_observer.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "chrome/browser/search/background/ntp_background_service.h"
#include "chrome/browser/search/background/ntp_background_service_observer.h"
+#include "chrome/browser/search/one_google_bar/one_google_bar_service.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_service_observer.h"
+#include "chrome/browser/search/promos/promo_service.h"
#include "chrome/browser/search/promos/promo_service_observer.h"
+#include "chrome/browser/search/search_suggest/search_suggest_service.h"
#include "chrome/browser/search/search_suggest/search_suggest_service_observer.h"
#include "components/prefs/pref_registry_simple.h"
#include "content/public/browser/url_data_source.h"
@@ -28,10 +32,6 @@
struct OneGoogleBarData;
struct PromoData;
-class NtpBackgroundService;
-class OneGoogleBarService;
-class PromoService;
-class SearchSuggestService;
class Profile;
namespace search_provider_logos {
@@ -137,7 +137,7 @@
NtpBackgroundService* ntp_background_service_;
ScopedObserver<NtpBackgroundService, NtpBackgroundServiceObserver>
- ntp_background_service_observer_;
+ ntp_background_service_observer_{this};
base::Optional<base::TimeTicks> pending_one_google_bar_request_;
std::vector<content::URLDataSource::GotDataCallback>
@@ -146,21 +146,22 @@
OneGoogleBarService* one_google_bar_service_;
ScopedObserver<OneGoogleBarService, OneGoogleBarServiceObserver>
- one_google_bar_service_observer_;
+ one_google_bar_service_observer_{this};
base::Optional<base::TimeTicks> pending_promo_request_;
std::vector<content::URLDataSource::GotDataCallback> promo_callbacks_;
PromoService* promo_service_;
- ScopedObserver<PromoService, PromoServiceObserver> promo_service_observer_;
+ ScopedObserver<PromoService, PromoServiceObserver> promo_service_observer_{
+ this};
base::Optional<base::TimeTicks> pending_search_suggest_request_;
SearchSuggestService* search_suggest_service_;
ScopedObserver<SearchSuggestService, SearchSuggestServiceObserver>
- search_suggest_service_observer_;
+ search_suggest_service_observer_{this};
search_provider_logos::LogoService* logo_service_;
std::unique_ptr<DesktopLogoObserver> logo_observer_;
diff --git a/chrome/browser/search/search_engine_base_url_tracker.cc b/chrome/browser/search/search_engine_base_url_tracker.cc
index becc1ab..108e6f6 100644
--- a/chrome/browser/search/search_engine_base_url_tracker.cc
+++ b/chrome/browser/search/search_engine_base_url_tracker.cc
@@ -6,7 +6,6 @@
#include "components/search_engines/search_terms_data.h"
-#include "components/search_engines/template_url_service.h"
SearchEngineBaseURLTracker::SearchEngineBaseURLTracker(
TemplateURLService* template_url_service,
@@ -15,7 +14,6 @@
: template_url_service_(template_url_service),
search_terms_data_(std::move(search_terms_data)),
base_url_changed_callback_(base_url_changed_callback),
- observer_(this),
previous_google_base_url_(search_terms_data_->GoogleBaseURLValue()) {
DCHECK(template_url_service_);
diff --git a/chrome/browser/search/search_engine_base_url_tracker.h b/chrome/browser/search/search_engine_base_url_tracker.h
index 81845969..78d34c6 100644
--- a/chrome/browser/search/search_engine_base_url_tracker.h
+++ b/chrome/browser/search/search_engine_base_url_tracker.h
@@ -12,11 +12,11 @@
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "components/search_engines/template_url_data.h"
+#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
#include "url/gurl.h"
class SearchTermsData;
-class TemplateURLService;
// A helper class that watches for changes to the base URL of the default search
// engine. Typically this changes when a different DSE is selected. For Google,
@@ -48,7 +48,8 @@
std::unique_ptr<SearchTermsData> search_terms_data_;
BaseURLChangedCallback base_url_changed_callback_;
- ScopedObserver<TemplateURLService, TemplateURLServiceObserver> observer_;
+ ScopedObserver<TemplateURLService, TemplateURLServiceObserver> observer_{
+ this};
// Used to check whether notifications from TemplateURLService indicate a
// change that affects the default search provider.
diff --git a/chrome/browser/search_engines/chrome_template_url_service_client.cc b/chrome/browser/search_engines/chrome_template_url_service_client.cc
index 8de531d..8edade1 100644
--- a/chrome/browser/search_engines/chrome_template_url_service_client.cc
+++ b/chrome/browser/search_engines/chrome_template_url_service_client.cc
@@ -4,13 +4,11 @@
#include "chrome/browser/search_engines/chrome_template_url_service_client.h"
-#include "components/history/core/browser/history_service.h"
#include "components/search_engines/template_url_service.h"
ChromeTemplateURLServiceClient::ChromeTemplateURLServiceClient(
history::HistoryService* history_service)
: owner_(NULL),
- history_service_observer_(this),
history_service_(history_service) {
// TODO(sky): bug 1166191. The keywords should be moved into the history
// db, which will mean we no longer need this notification and the history
diff --git a/chrome/browser/search_engines/chrome_template_url_service_client.h b/chrome/browser/search_engines/chrome_template_url_service_client.h
index 8d849393a..8505a559 100644
--- a/chrome/browser/search_engines/chrome_template_url_service_client.h
+++ b/chrome/browser/search_engines/chrome_template_url_service_client.h
@@ -7,13 +7,10 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/search_engines/template_url_service_client.h"
-namespace history {
-class HistoryService;
-}
-
// ChromeTemplateURLServiceClient provides keyword related history
// functionality for TemplateURLService.
class ChromeTemplateURLServiceClient : public TemplateURLServiceClient,
@@ -42,7 +39,7 @@
private:
TemplateURLService* owner_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_service_observer_;
+ history_service_observer_{this};
history::HistoryService* history_service_;
DISALLOW_COPY_AND_ASSIGN(ChromeTemplateURLServiceClient);
diff --git a/chrome/browser/sessions/session_restore_stats_collector.cc b/chrome/browser/sessions/session_restore_stats_collector.cc
index 7ea3a86..eb1d69f7 100644
--- a/chrome/browser/sessions/session_restore_stats_collector.cc
+++ b/chrome/browser/sessions/session_restore_stats_collector.cc
@@ -15,7 +15,6 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
@@ -125,8 +124,7 @@
loading_tab_count_(0u),
deferred_tab_count_(0u),
tick_clock_(new base::DefaultTickClock()),
- reporting_delegate_(std::move(reporting_delegate)),
- observer_(this) {
+ reporting_delegate_(std::move(reporting_delegate)) {
this_retainer_ = this;
}
diff --git a/chrome/browser/sessions/session_restore_stats_collector.h b/chrome/browser/sessions/session_restore_stats_collector.h
index d75d443..b3c1009b 100644
--- a/chrome/browser/sessions/session_restore_stats_collector.h
+++ b/chrome/browser/sessions/session_restore_stats_collector.h
@@ -19,11 +19,11 @@
#include "chrome/browser/sessions/session_restore_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_observer.h"
namespace content {
class NavigationController;
-class RenderWidgetHost;
}
// SessionRestoreStatsCollector observes SessionRestore events ands records UMA
@@ -282,8 +282,8 @@
// has deferred tabs remaining from an interrupted session restore.
scoped_refptr<SessionRestoreStatsCollector> this_retainer_;
- ScopedObserver<content::RenderWidgetHost, SessionRestoreStatsCollector>
- observer_;
+ ScopedObserver<content::RenderWidgetHost, content::RenderWidgetHostObserver>
+ observer_{this};
DISALLOW_COPY_AND_ASSIGN(SessionRestoreStatsCollector);
};
diff --git a/chrome/browser/signin/signin_profile_attributes_updater.cc b/chrome/browser/signin/signin_profile_attributes_updater.cc
index 076df05d..5417b5fc 100644
--- a/chrome/browser/signin/signin_profile_attributes_updater.cc
+++ b/chrome/browser/signin/signin_profile_attributes_updater.cc
@@ -20,9 +20,7 @@
: identity_manager_(identity_manager),
signin_error_controller_(signin_error_controller),
profile_attributes_storage_(profile_attributes_storage),
- profile_path_(profile_path),
- identity_manager_observer_(this),
- signin_error_controller_observer_(this) {
+ profile_path_(profile_path) {
DCHECK(identity_manager_);
DCHECK(signin_error_controller_);
DCHECK(profile_attributes_storage_);
diff --git a/chrome/browser/signin/signin_profile_attributes_updater.h b/chrome/browser/signin/signin_profile_attributes_updater.h
index 0c77301c..dc368db5 100644
--- a/chrome/browser/signin/signin_profile_attributes_updater.h
+++ b/chrome/browser/signin/signin_profile_attributes_updater.h
@@ -51,10 +51,10 @@
SigninErrorController* signin_error_controller_;
ProfileAttributesStorage* profile_attributes_storage_;
const base::FilePath profile_path_;
- ScopedObserver<signin::IdentityManager, SigninProfileAttributesUpdater>
- identity_manager_observer_;
- ScopedObserver<SigninErrorController, SigninProfileAttributesUpdater>
- signin_error_controller_observer_;
+ ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
+ identity_manager_observer_{this};
+ ScopedObserver<SigninErrorController, SigninErrorController::Observer>
+ signin_error_controller_observer_{this};
DISALLOW_COPY_AND_ASSIGN(SigninProfileAttributesUpdater);
};
diff --git a/chrome/browser/signin/signin_util.cc b/chrome/browser/signin/signin_util.cc
index 1c0966c..78baf7f 100644
--- a/chrome/browser/signin/signin_util.cc
+++ b/chrome/browser/signin/signin_util.cc
@@ -39,6 +39,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/browser_window.h"
+#define CAN_DELETE_PROFILE
#endif
namespace signin_util {
@@ -46,10 +47,6 @@
constexpr char kSignoutSettingKey[] = "signout_setting";
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
-#define CAN_DELETE_PROFILE
-#endif
-
#if defined(CAN_DELETE_PROFILE)
// Manager that presents the profile will be deleted dialog on the first active
// browser window.
@@ -67,12 +64,12 @@
Delegate* delegate)
: profile_(profile),
primary_account_email_(primary_account_email),
- delegate_(delegate),
- browser_observer_(this) {}
- ~DeleteProfileDialogManager() override {}
+ delegate_(delegate) {}
+
+ ~DeleteProfileDialogManager() override { BrowserList::RemoveObserver(this); }
void PresentDialogOnAllBrowserWindows() {
- browser_observer_.Add(BrowserList::GetInstance());
+ BrowserList::AddObserver(this);
Browser* active_browser = chrome::FindLastActiveWithProfile(profile_);
if (active_browser)
OnBrowserSetLastActive(active_browser);
@@ -104,7 +101,6 @@
Profile* profile_;
std::string primary_account_email_;
Delegate* delegate_;
- ScopedObserver<BrowserList, DeleteProfileDialogManager> browser_observer_;
DISALLOW_COPY_AND_ASSIGN(DeleteProfileDialogManager);
};
diff --git a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
index 256bd83..aaa90cbe 100644
--- a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
@@ -16,7 +16,6 @@
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
-#include "components/history/core/browser/history_service.h"
#include "components/keyed_service/core/service_access_type.h"
#include "url/gurl.h"
@@ -39,8 +38,7 @@
SubresourceFilterContentSettingsManager::
SubresourceFilterContentSettingsManager(Profile* profile)
- : history_observer_(this),
- settings_map_(HostContentSettingsMapFactory::GetForProfile(profile)),
+ : settings_map_(HostContentSettingsMapFactory::GetForProfile(profile)),
clock_(std::make_unique<base::DefaultClock>(base::DefaultClock())),
should_use_smart_ui_(ShouldUseSmartUI()) {
DCHECK(profile);
diff --git a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h
index e515d92..ff13379 100644
--- a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h
+++ b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h
@@ -13,6 +13,7 @@
#include "base/time/clock.h"
#include "base/time/time.h"
#include "components/content_settings/core/common/content_settings.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
class GURL;
@@ -23,10 +24,6 @@
class DictionaryValue;
} // namespace base
-namespace history {
-class HistoryService;
-} // namespace history
-
// This class contains helpers to get/set content and website settings related
// to subresource filtering.
// TODO(crbug.com/706061): Once observing changes to content settings is robust
@@ -83,7 +80,7 @@
std::unique_ptr<base::DictionaryValue> dict);
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_observer_;
+ history_observer_{this};
HostContentSettingsMap* settings_map_;
diff --git a/chrome/browser/web_applications/components/app_registrar.cc b/chrome/browser/web_applications/components/app_registrar.cc
index 63fb5f73a..b5c625e8 100644
--- a/chrome/browser/web_applications/components/app_registrar.cc
+++ b/chrome/browser/web_applications/components/app_registrar.cc
@@ -28,7 +28,7 @@
observers_.AddObserver(observer);
}
-void AppRegistrar::RemoveObserver(const AppRegistrarObserver* observer) {
+void AppRegistrar::RemoveObserver(AppRegistrarObserver* observer) {
observers_.RemoveObserver(observer);
}
diff --git a/chrome/browser/web_applications/components/app_registrar.h b/chrome/browser/web_applications/components/app_registrar.h
index 9582181..f4334f4d 100644
--- a/chrome/browser/web_applications/components/app_registrar.h
+++ b/chrome/browser/web_applications/components/app_registrar.h
@@ -94,7 +94,7 @@
bool IsLocallyInstalled(const GURL& start_url) const;
void AddObserver(AppRegistrarObserver* observer);
- void RemoveObserver(const AppRegistrarObserver* observer);
+ void RemoveObserver(AppRegistrarObserver* observer);
void NotifyWebAppInstalled(const AppId& app_id);