summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 07:07:18 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 07:07:18 +0000
commit42599f8282ae724f2aec50ff4ac91bebbc0451e6 (patch)
tree47b890c20f519b5800cb093c38dd5c4a867c07bd /chrome
parent5f794c15856aaa57b8b84f3bb89f2f744447ed23 (diff)
downloadchromium_src-42599f8282ae724f2aec50ff4ac91bebbc0451e6.zip
chromium_src-42599f8282ae724f2aec50ff4ac91bebbc0451e6.tar.gz
chromium_src-42599f8282ae724f2aec50ff4ac91bebbc0451e6.tar.bz2
Make sure the download status in the application icon is updated
when an incognito window is closed. This also avoids crash described in http://code.google.com/p/chromium/issues/detail?id=56722#c12 We need to remove the half-destroyed Browser from BrowserList before we start iterating over BrowserList when updating the application icon. BUG=48391 TEST=see bug Review URL: http://codereview.chromium.org/3719004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc8
-rw-r--r--chrome/browser/automation/testing_automation_provider.h4
-rw-r--r--chrome/browser/browser_init_browsertest.cc2
-rw-r--r--chrome/browser/browser_list.cc10
-rw-r--r--chrome/browser/browser_list.h5
-rw-r--r--chrome/browser/chromeos/tab_closeable_state_watcher.cc2
-rw-r--r--chrome/browser/chromeos/tab_closeable_state_watcher.h2
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.cc3
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.h5
-rw-r--r--chrome/browser/download/download_status_updater.cc2
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc2
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.h2
12 files changed, 22 insertions, 25 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 7e6ed0c..f62535d 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -4011,11 +4011,11 @@ void TestingAutomationProvider::OnRedirectQueryComplete(
void TestingAutomationProvider::OnBrowserAdded(const Browser* browser) {
}
-void TestingAutomationProvider::OnBrowserRemoving(const Browser* browser) {
+void TestingAutomationProvider::OnBrowserRemoved(const Browser* browser) {
// For backwards compatibility with the testing automation interface, we
// want the automation provider (and hence the process) to go away when the
// last browser goes away.
- if (BrowserList::size() == 1 && !CommandLine::ForCurrentProcess()->HasSwitch(
+ if (BrowserList::empty() && !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kKeepAliveForTest)) {
// If you change this, update Observer for NotificationType::SESSION_END
// below.
@@ -4028,9 +4028,9 @@ void TestingAutomationProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type == NotificationType::SESSION_END);
- // OnBrowserRemoving does a ReleaseLater. When session end is received we exit
+ // OnBrowserRemoved does a ReleaseLater. When session end is received we exit
// before the task runs resulting in this object not being deleted. This
- // Release balance out the Release scheduled by OnBrowserRemoving.
+ // Release balance out the Release scheduled by OnBrowserRemoved.
Release();
}
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index 715a89f..e0a505e 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -23,10 +23,8 @@ class TestingAutomationProvider : public AutomationProvider,
explicit TestingAutomationProvider(Profile* profile);
// BrowserList::Observer implementation
- // Called immediately after a browser is added to the list
virtual void OnBrowserAdded(const Browser* browser);
- // Called immediately before a browser is removed from the list
- virtual void OnBrowserRemoving(const Browser* browser);
+ virtual void OnBrowserRemoved(const Browser* browser);
// IPC implementations
virtual void OnMessageReceived(const IPC::Message& msg);
diff --git a/chrome/browser/browser_init_browsertest.cc b/chrome/browser/browser_init_browsertest.cc
index bad04f1..deac3e2 100644
--- a/chrome/browser/browser_init_browsertest.cc
+++ b/chrome/browser/browser_init_browsertest.cc
@@ -26,7 +26,7 @@ class OpenURLsPopupObserver : public BrowserList::Observer {
added_browser_ = browser;
}
- virtual void OnBrowserRemoving(const Browser* browser) { }
+ virtual void OnBrowserRemoved(const Browser* browser) { }
const Browser* added_browser_;
};
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc
index 31e09cc..0803db5 100644
--- a/chrome/browser/browser_list.cc
+++ b/chrome/browser/browser_list.cc
@@ -177,15 +177,15 @@ void BrowserList::RemoveBrowser(Browser* browser) {
NotificationType::BROWSER_CLOSED,
Source<Browser>(browser), Details<bool>(&closing_last_browser));
- // Send out notifications before anything changes. Do some basic checking to
- // try to catch evil observers that change the list from under us.
+ RemoveBrowserFrom(browser, &browsers_);
+
+ // Do some basic checking to try to catch evil observers
+ // that change the list from under us.
size_t original_count = observers_.size();
- FOR_EACH_OBSERVER(Observer, observers_, OnBrowserRemoving(browser));
+ FOR_EACH_OBSERVER(Observer, observers_, OnBrowserRemoved(browser));
DCHECK_EQ(original_count, observers_.size())
<< "observer list modified during notification";
- RemoveBrowserFrom(browser, &browsers_);
-
// If the last Browser object was destroyed, make sure we try to close any
// remaining dependent windows too.
if (browsers_.empty()) {
diff --git a/chrome/browser/browser_list.h b/chrome/browser/browser_list.h
index dcde7fb..0d680ae 100644
--- a/chrome/browser/browser_list.h
+++ b/chrome/browser/browser_list.h
@@ -26,8 +26,8 @@ class BrowserList {
// Called immediately after a browser is added to the list
virtual void OnBrowserAdded(const Browser* browser) = 0;
- // Called immediately before a browser is removed from the list
- virtual void OnBrowserRemoving(const Browser* browser) = 0;
+ // Called immediately after a browser is removed from the list
+ virtual void OnBrowserRemoved(const Browser* browser) = 0;
// Called immediately after a browser is set active (SetLastActive)
virtual void OnBrowserSetLastActive(const Browser* browser) {}
@@ -130,6 +130,7 @@ class BrowserList {
static const_iterator begin() { return browsers_.begin(); }
static const_iterator end() { return browsers_.end(); }
+ static bool empty() { return browsers_.empty(); }
static size_t size() { return browsers_.size(); }
// Returns iterated access to list of open browsers ordered by when
diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher.cc b/chrome/browser/chromeos/tab_closeable_state_watcher.cc
index 25bbf6e..f3e867b 100644
--- a/chrome/browser/chromeos/tab_closeable_state_watcher.cc
+++ b/chrome/browser/chromeos/tab_closeable_state_watcher.cc
@@ -118,7 +118,7 @@ void TabCloseableStateWatcher::OnBrowserAdded(const Browser* browser) {
// TabInsertedAt notification to check for change in state.
}
-void TabCloseableStateWatcher::OnBrowserRemoving(const Browser* browser) {
+void TabCloseableStateWatcher::OnBrowserRemoved(const Browser* browser) {
// Only normal browsers may affect closeable state.
if (browser->type() != Browser::TYPE_NORMAL)
return;
diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher.h b/chrome/browser/chromeos/tab_closeable_state_watcher.h
index 9da71f2..2620304 100644
--- a/chrome/browser/chromeos/tab_closeable_state_watcher.h
+++ b/chrome/browser/chromeos/tab_closeable_state_watcher.h
@@ -60,7 +60,7 @@ class TabCloseableStateWatcher : public ::TabCloseableStateWatcher,
// BrowserList::Observer implementation:
virtual void OnBrowserAdded(const Browser* browser);
- virtual void OnBrowserRemoving(const Browser* browser);
+ virtual void OnBrowserRemoved(const Browser* browser);
// NotificationObserver implementation:
virtual void Observe(NotificationType type, const NotificationSource& source,
diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc
index 8fbd74f..cc0087f 100644
--- a/chrome/browser/chromeos/wm_overview_controller.cc
+++ b/chrome/browser/chromeos/wm_overview_controller.cc
@@ -508,8 +508,7 @@ void WmOverviewController::SnapshotImageChanged(RenderWidgetHost* renderer) {
}
}
-// Called immediately before a browser is removed from the list.
-void WmOverviewController::OnBrowserRemoving(const Browser* browser) {
+void WmOverviewController::OnBrowserRemoved(const Browser* browser) {
for (BrowserListenerVector::iterator i = listeners_.begin();
i != listeners_.end(); ++i) {
if ((*i)->browser() == browser) {
diff --git a/chrome/browser/chromeos/wm_overview_controller.h b/chrome/browser/chromeos/wm_overview_controller.h
index c007b72..d308129 100644
--- a/chrome/browser/chromeos/wm_overview_controller.h
+++ b/chrome/browser/chromeos/wm_overview_controller.h
@@ -67,11 +67,8 @@ class WmOverviewController : public BrowserList::Observer,
static WmOverviewController* instance();
// BrowserList::Observer methods
- // This is called immediately after a browser is added to the list.
void OnBrowserAdded(const Browser* browser) {}
-
- // This is called immediately before a browser is removed from the list.
- void OnBrowserRemoving(const Browser* browser);
+ void OnBrowserRemoved(const Browser* browser);
// End BrowserList::Observer methods
// WmMessageListener::Observer methods
diff --git a/chrome/browser/download/download_status_updater.cc b/chrome/browser/download/download_status_updater.cc
index 35b7adf..fa19e4a 100644
--- a/chrome/browser/download/download_status_updater.cc
+++ b/chrome/browser/download/download_status_updater.cc
@@ -17,11 +17,13 @@ DownloadStatusUpdater::~DownloadStatusUpdater() {
void DownloadStatusUpdater::AddDelegate(
DownloadStatusUpdaterDelegate* delegate) {
delegates_.insert(delegate);
+ Update();
}
void DownloadStatusUpdater::RemoveDelegate(
DownloadStatusUpdaterDelegate* delegate) {
delegates_.erase(delegate);
+ Update();
}
void DownloadStatusUpdater::Update() {
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index f139c3b..80a6309 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -193,7 +193,7 @@ void ExtensionBrowserEventRouter::OnBrowserWindowReady(const Browser* browser) {
DispatchEvent(browser->profile(), events::kOnWindowCreated, json_args);
}
-void ExtensionBrowserEventRouter::OnBrowserRemoving(const Browser* browser) {
+void ExtensionBrowserEventRouter::OnBrowserRemoved(const Browser* browser) {
// Stop listening to TabStripModel events for this browser.
browser->tabstrip_model()->RemoveObserver(this);
diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h
index c2c7ca3..a39da32 100644
--- a/chrome/browser/extensions/extension_browser_event_router.h
+++ b/chrome/browser/extensions/extension_browser_event_router.h
@@ -44,7 +44,7 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver,
// BrowserList::Observer
virtual void OnBrowserAdded(const Browser* browser);
- virtual void OnBrowserRemoving(const Browser* browser);
+ virtual void OnBrowserRemoved(const Browser* browser);
virtual void OnBrowserSetLastActive(const Browser* browser);
#if defined(TOOLKIT_VIEWS)