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) ...@@ -117,7 +117,7 @@ AutomationProvider::AutomationProvider(Profile* profile)
extension_tracker_.reset(new AutomationExtensionTracker(this)); extension_tracker_.reset(new AutomationExtensionTracker(this));
tab_tracker_.reset(new AutomationTabTracker(this)); tab_tracker_.reset(new AutomationTabTracker(this));
window_tracker_.reset(new AutomationWindowTracker(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()); metric_event_duration_observer_.reset(new MetricEventDurationObserver());
extension_test_result_observer_.reset( extension_test_result_observer_.reset(
new ExtensionTestResultNotificationObserver(this)); new ExtensionTestResultNotificationObserver(this));
......
...@@ -160,10 +160,11 @@ void InitialLoadObserver::ConditionMet() { ...@@ -160,10 +160,11 @@ void InitialLoadObserver::ConditionMet() {
automation_->OnInitialTabLoadsComplete(); automation_->OnInitialTabLoadsComplete();
} }
NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation) NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation,
Profile* profile)
: automation_(automation->AsWeakPtr()) { : automation_(automation->AsWeakPtr()) {
registrar_.Add(this, chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, registrar_.Add(this, chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD,
NotificationService::AllSources()); Source<Profile>(profile));
} }
NewTabUILoadObserver::~NewTabUILoadObserver() { NewTabUILoadObserver::~NewTabUILoadObserver() {
...@@ -763,9 +764,9 @@ BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver( ...@@ -763,9 +764,9 @@ BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver(
new_window_id_(extension_misc::kUnknownWindowId), new_window_id_(extension_misc::kUnknownWindowId),
for_browser_command_(false) { for_browser_command_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
} }
BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() { BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() {
...@@ -859,9 +860,9 @@ BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver( ...@@ -859,9 +860,9 @@ BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver(
automation_(automation->AsWeakPtr()), automation_(automation->AsWeakPtr()),
reply_message_(reply_message) { reply_message_(reply_message) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
} }
BrowserCountChangeNotificationObserver:: BrowserCountChangeNotificationObserver::
......
...@@ -58,6 +58,7 @@ class Browser; ...@@ -58,6 +58,7 @@ class Browser;
class Extension; class Extension;
class ExtensionProcessManager; class ExtensionProcessManager;
class NavigationController; class NavigationController;
class Profile;
class RenderViewHost; class RenderViewHost;
class SavePackage; class SavePackage;
class TabContents; class TabContents;
...@@ -134,7 +135,8 @@ class NetworkManagerInitObserver ...@@ -134,7 +135,8 @@ class NetworkManagerInitObserver
// Watches for NewTabUI page loads for performance timing purposes. // Watches for NewTabUI page loads for performance timing purposes.
class NewTabUILoadObserver : public NotificationObserver { class NewTabUILoadObserver : public NotificationObserver {
public: public:
explicit NewTabUILoadObserver(AutomationProvider* automation); explicit NewTabUILoadObserver(AutomationProvider* automation,
Profile* profile);
virtual ~NewTabUILoadObserver(); virtual ~NewTabUILoadObserver();
virtual void Observe(int type, virtual void Observe(int type,
......
...@@ -535,7 +535,7 @@ bool MetricsService::reporting_active() const { ...@@ -535,7 +535,7 @@ bool MetricsService::reporting_active() const {
void MetricsService::SetUpNotifications(NotificationRegistrar* registrar, void MetricsService::SetUpNotifications(NotificationRegistrar* registrar,
NotificationObserver* observer) { NotificationObserver* observer) {
registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED, registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources()); NotificationService::AllSources());
registrar->Add(observer, content::NOTIFICATION_USER_ACTION, registrar->Add(observer, content::NOTIFICATION_USER_ACTION,
......
...@@ -309,7 +309,7 @@ class OffTheRecordObserver : public NotificationObserver { ...@@ -309,7 +309,7 @@ class OffTheRecordObserver : public NotificationObserver {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources()); NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
} }
} }
......
...@@ -469,7 +469,7 @@ void SessionService::Init() { ...@@ -469,7 +469,7 @@ void SessionService::Init() {
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
NotificationService::AllSources()); NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Add( registrar_.Add(
this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
NotificationService::AllSources()); NotificationService::AllSources());
......
...@@ -280,7 +280,7 @@ void SessionChangeProcessor::StartObserving() { ...@@ -280,7 +280,7 @@ void SessionChangeProcessor::StartObserving() {
notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
NotificationService::AllSources()); NotificationService::AllSources());
notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
notification_registrar_.Add(this, notification_registrar_.Add(this,
chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
NotificationService::AllSources()); NotificationService::AllSources());
......
...@@ -27,7 +27,7 @@ PinnedTabService::PinnedTabService(Profile* profile) ...@@ -27,7 +27,7 @@ PinnedTabService::PinnedTabService(Profile* profile)
got_exiting_(false), got_exiting_(false),
has_normal_browser_(false) { has_normal_browser_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
NotificationService::AllSources()); NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_APP_EXITING, registrar_.Add(this, content::NOTIFICATION_APP_EXITING,
......
...@@ -192,19 +192,21 @@ void LoginHandler::OnRequestCancelled() { ...@@ -192,19 +192,21 @@ void LoginHandler::OnRequestCancelled() {
void LoginHandler::AddObservers() { void LoginHandler::AddObservers() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 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, registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
} }
void LoginHandler::RemoveObservers() { void LoginHandler::RemoveObservers() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
registrar_.Remove(this, chrome::NOTIFICATION_AUTH_SUPPLIED, registrar_.Remove(this, chrome::NOTIFICATION_AUTH_SUPPLIED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
registrar_.Remove(this, chrome::NOTIFICATION_AUTH_CANCELLED, registrar_.Remove(this, chrome::NOTIFICATION_AUTH_CANCELLED,
NotificationService::AllSources()); NotificationService::AllBrowserContextsAndSources());
DCHECK(registrar_.IsEmpty()); 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