diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 21:15:48 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 21:15:48 +0000 |
commit | 32a66aed0e57642c8f0da0a4a34383bbc9250a32 (patch) | |
tree | 68d9c7919f9d148cfa8a2537f734143db7e6e94f /chrome/browser/browser_list.cc | |
parent | f8bddcfb577500d541351efa8986cc89d8859d02 (diff) | |
download | chromium_src-32a66aed0e57642c8f0da0a4a34383bbc9250a32.zip chromium_src-32a66aed0e57642c8f0da0a4a34383bbc9250a32.tar.gz chromium_src-32a66aed0e57642c8f0da0a4a34383bbc9250a32.tar.bz2 |
window.cc should not include browser_list.h ... dependent (non-browser) windows are closed when they receive a notification rather than by being called directly from BrowserList. Also browser_list.cc should not include window.h, required for porting.
TEST=Open browser. Open options dialog box. Close browser. Options dialog should close too.
Review URL: http://codereview.chromium.org/18328
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_list.cc')
-rw-r--r-- | chrome/browser/browser_list.cc | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index 7a09d96..ea64570 100644 --- a/chrome/browser/browser_list.cc +++ b/chrome/browser/browser_list.cc @@ -14,11 +14,9 @@ #include "chrome/browser/profile_manager.h" #include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/notification_service.h" -#include "chrome/views/window.h" BrowserList::list_type BrowserList::browsers_; std::vector<BrowserList::Observer*> BrowserList::observers_; -BrowserList::DependentWindowList BrowserList::dependent_windows_; // static void BrowserList::AddBrowser(Browser* browser) { @@ -60,27 +58,12 @@ void BrowserList::RemoveBrowser(Browser* browser) { // If the last Browser object was destroyed, make sure we try to close any // remaining dependent windows too. - if (browsers_.empty()) - CloseAllDependentWindows(); - - g_browser_process->ReleaseModule(); -} - -// static -void BrowserList::AddDependentWindow(views::Window* window) { - DependentWindowList::const_iterator existing = - find(dependent_windows_.begin(), dependent_windows_.end(), window); - DCHECK(existing == dependent_windows_.end()); - dependent_windows_.push_back(window); - g_browser_process->AddRefModule(); -} + if (browsers_.empty()) { + NotificationService::current()->Notify(NOTIFY_ALL_APPWINDOWS_CLOSED, + NotificationService::AllSources(), + NotificationService::NoDetails()); + } -// static -void BrowserList::RemoveDependentWindow(views::Window* window) { - DependentWindowList::iterator existing = - find(dependent_windows_.begin(), dependent_windows_.end(), window); - DCHECK(existing != dependent_windows_.end()); - dependent_windows_.erase(existing); g_browser_process->ReleaseModule(); } @@ -262,18 +245,6 @@ bool BrowserList::IsOffTheRecordSessionActive() { } // static -void BrowserList::CloseAllDependentWindows() { - // Note that |dependent_windows_| is guaranteed to be consistent for the - // duration of this operation because windows are not actually closed - // (destroyed, then deleted, and thus removed from this list) until we return - // to the message loop. So this basically just schedules a bunch of close - // operations to be performed asynchronously. - DependentWindowList::iterator window = dependent_windows_.begin(); - for (; window != dependent_windows_.end(); ++window) - (*window)->Close(); -} - -// static void BrowserList::RemoveBrowserFrom(Browser* browser, list_type* browser_list) { const iterator remove_browser = find(browser_list->begin(), browser_list->end(), browser); |