Commit 04024e2c authored by erg@google.com's avatar erg@google.com

Profiles: Clear all BROWSER_OPENED usage

BUG=87457
TEST=none
R=mirandac
TBR=zea,willchan

Review URL: http://codereview.chromium.org/7639002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96596 0039d316-1c4b-4281-b951-d872f2087c98
parent 22677ea5
......@@ -117,7 +117,7 @@ AutomationProvider::AutomationProvider(Profile* profile)
extension_tracker_.reset(new AutomationExtensionTracker(this));
tab_tracker_.reset(new AutomationTabTracker(this));
window_tracker_.reset(new AutomationWindowTracker(this));
new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this));
new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this, profile));
metric_event_duration_observer_.reset(new MetricEventDurationObserver());
extension_test_result_observer_.reset(
new ExtensionTestResultNotificationObserver(this));
......
......@@ -160,10 +160,11 @@ void InitialLoadObserver::ConditionMet() {
automation_->OnInitialTabLoadsComplete();
}
NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation)
NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation,
Profile* profile)
: automation_(automation->AsWeakPtr()) {
registrar_.Add(this, chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD,
NotificationService::AllSources());
Source<Profile>(profile));
}
NewTabUILoadObserver::~NewTabUILoadObserver() {
......@@ -763,9 +764,9 @@ BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver(
new_window_id_(extension_misc::kUnknownWindowId),
for_browser_command_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
}
BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() {
......@@ -859,9 +860,9 @@ BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver(
automation_(automation->AsWeakPtr()),
reply_message_(reply_message) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
}
BrowserCountChangeNotificationObserver::
......
......@@ -58,6 +58,7 @@ class Browser;
class Extension;
class ExtensionProcessManager;
class NavigationController;
class Profile;
class RenderViewHost;
class SavePackage;
class TabContents;
......@@ -134,7 +135,8 @@ class NetworkManagerInitObserver
// Watches for NewTabUI page loads for performance timing purposes.
class NewTabUILoadObserver : public NotificationObserver {
public:
explicit NewTabUILoadObserver(AutomationProvider* automation);
explicit NewTabUILoadObserver(AutomationProvider* automation,
Profile* profile);
virtual ~NewTabUILoadObserver();
virtual void Observe(int type,
......
......@@ -535,7 +535,7 @@ bool MetricsService::reporting_active() const {
void MetricsService::SetUpNotifications(NotificationRegistrar* registrar,
NotificationObserver* observer) {
registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources());
registrar->Add(observer, content::NOTIFICATION_USER_ACTION,
......
......@@ -309,7 +309,7 @@ class OffTheRecordObserver : public NotificationObserver {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
}
}
......
......@@ -469,7 +469,7 @@ void SessionService::Init() {
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Add(
this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
NotificationService::AllSources());
......
......@@ -280,7 +280,7 @@ void SessionChangeProcessor::StartObserving() {
notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
notification_registrar_.Add(this,
chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
NotificationService::AllSources());
......
......@@ -27,7 +27,7 @@ PinnedTabService::PinnedTabService(Profile* profile)
got_exiting_(false),
has_normal_browser_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_APP_EXITING,
......
......@@ -192,19 +192,21 @@ void LoginHandler::OnRequestCancelled() {
void LoginHandler::AddObservers() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// This is probably OK; we need to listen to everything and we break out of
// the Observe() if we aren't handling the same auth_info().
registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
}
void LoginHandler::RemoveObservers() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
registrar_.Remove(this, chrome::NOTIFICATION_AUTH_SUPPLIED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
registrar_.Remove(this, chrome::NOTIFICATION_AUTH_CANCELLED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
DCHECK(registrar_.IsEmpty());
}
......
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