summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/shell.cc2
-rw-r--r--ash/shell/shell_delegate_impl.cc2
-rw-r--r--ash/shell/shell_delegate_impl.h2
-rw-r--r--ash/shell_delegate.h5
-rw-r--r--ash/test/test_shell_delegate.cc2
-rw-r--r--ash/test/test_shell_delegate.h2
-rw-r--r--chrome/browser/browser_shutdown.cc15
-rw-r--r--chrome/browser/browser_shutdown.h9
-rw-r--r--chrome/browser/chrome_browser_main_extra_parts_x11.cc2
-rw-r--r--chrome/browser/lifetime/application_lifetime.cc5
-rw-r--r--chrome/browser/ui/ash/ash_init.cc7
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.h2
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc16
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate_views.cc2
-rw-r--r--chrome/browser/ui/browser.cc4
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc8
17 files changed, 19 insertions, 70 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 8f47b57..4c12d32 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -630,6 +630,8 @@ Shell::Shell(ShellDelegate* delegate)
Shell::~Shell() {
TRACE_EVENT0("shutdown", "ash::Shell::Destructor");
+ delegate_->PreShutdown();
+
views::FocusManagerFactory::Install(NULL);
// Remove the focus from any window. This will prevent overhead and side
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index d21f7ac..4efd104 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -101,7 +101,7 @@ bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
void ShellDelegateImpl::PreInit() {
}
-void ShellDelegateImpl::Shutdown() {
+void ShellDelegateImpl::PreShutdown() {
}
void ShellDelegateImpl::Exit() {
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 2b5aa12..705ef21 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -39,7 +39,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual bool IsMultiProfilesEnabled() const OVERRIDE;
virtual bool IsRunningInForcedAppMode() const OVERRIDE;
virtual void PreInit() OVERRIDE;
- virtual void Shutdown() OVERRIDE;
+ virtual void PreShutdown() OVERRIDE;
virtual void Exit() OVERRIDE;
virtual keyboard::KeyboardControllerProxy*
CreateKeyboardControllerProxy() OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index ba28e0c..9a4ac77 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -76,8 +76,9 @@ class ASH_EXPORT ShellDelegate {
// can perform tasks necessary before the shell is initialized.
virtual void PreInit() = 0;
- // Shuts down the environment.
- virtual void Shutdown() = 0;
+ // Called at the beginninig of Shell destructor so that
+ // delegate can use Shell instance to perform cleanup tasks.
+ virtual void PreShutdown() = 0;
// Invoked when the user uses Ctrl-Shift-Q to close chrome.
virtual void Exit() = 0;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 57c76cc..fe981d7 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -80,7 +80,7 @@ bool TestShellDelegate::IsRunningInForcedAppMode() const {
void TestShellDelegate::PreInit() {
}
-void TestShellDelegate::Shutdown() {
+void TestShellDelegate::PreShutdown() {
}
void TestShellDelegate::Exit() {
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index a41d1bb..9e610b6 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -35,7 +35,7 @@ class TestShellDelegate : public ShellDelegate {
virtual bool IsMultiProfilesEnabled() const OVERRIDE;
virtual bool IsRunningInForcedAppMode() const OVERRIDE;
virtual void PreInit() OVERRIDE;
- virtual void Shutdown() OVERRIDE;
+ virtual void PreShutdown() OVERRIDE;
virtual void Exit() OVERRIDE;
virtual keyboard::KeyboardControllerProxy*
CreateKeyboardControllerProxy() OVERRIDE;
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 7ebee0d..37b1ba3 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -18,9 +18,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread.h"
-#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
-#include "build/build_config.h"
#include "chrome/browser/about_flags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run/upgrade_util.h"
@@ -36,8 +34,6 @@
#include "chrome/common/switch_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "ui/base/resource/resource_bundle.h"
#if defined(OS_WIN)
#include "chrome/browser/browser_util_win.h"
@@ -62,9 +58,6 @@ namespace {
// Whether the browser is trying to quit (e.g., Quit chosen from menu).
bool g_trying_to_quit = false;
-// Whether the browser should quit without closing browsers.
-bool g_shutting_down_without_closing_browsers = false;
-
#if defined(OS_WIN)
upgrade_util::RelaunchMode g_relaunch_mode =
upgrade_util::RELAUNCH_MODE_DEFAULT;
@@ -346,12 +339,4 @@ bool IsTryingToQuit() {
return g_trying_to_quit;
}
-bool ShuttingDownWithoutClosingBrowsers() {
- return g_shutting_down_without_closing_browsers;
-}
-
-void SetShuttingDownWithoutClosingBrowsers(bool without_close) {
- g_shutting_down_without_closing_browsers = without_close;
-}
-
} // namespace browser_shutdown
diff --git a/chrome/browser/browser_shutdown.h b/chrome/browser/browser_shutdown.h
index 208bb1d..f53de37 100644
--- a/chrome/browser/browser_shutdown.h
+++ b/chrome/browser/browser_shutdown.h
@@ -66,15 +66,6 @@ void SetTryingToQuit(bool quitting);
// General accessor.
bool IsTryingToQuit();
-// This is true on X during an END_SESSION initiated by X IO Error, when we
-// can no longer depend on the X server to be running. As a result we don't
-// explicitly close the browser windows, which can lead to conditions which
-// would fail checks.
-bool ShuttingDownWithoutClosingBrowsers();
-
-// Sets the ShuttingDownWithoutClosingBrowsers flag.
-void SetShuttingDownWithoutClosingBrowsers(bool without_close);
-
} // namespace browser_shutdown
#endif // CHROME_BROWSER_BROWSER_SHUTDOWN_H__
diff --git a/chrome/browser/chrome_browser_main_extra_parts_x11.cc b/chrome/browser/chrome_browser_main_extra_parts_x11.cc
index bcbf506..4afcda8 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_x11.cc
+++ b/chrome/browser/chrome_browser_main_extra_parts_x11.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/debug/debugger.h"
#include "base/message_loop/message_loop.h"
-#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/common/chrome_result_codes.h"
#include "content/public/browser/browser_thread.h"
@@ -55,7 +54,6 @@ int BrowserX11IOErrorHandler(Display* d) {
if (!g_in_x11_io_error_handler) {
g_in_x11_io_error_handler = true;
LOG(ERROR) << "X IO error received (X server probably went away)";
- browser_shutdown::SetShuttingDownWithoutClosingBrowsers(true);
chrome::SessionEnding();
}
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index b7eb115..ca2b639 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -113,9 +113,8 @@ void CloseAllBrowsers() {
// If there are no browsers and closing the last browser would quit the
// application, send the APP_TERMINATING action here. Otherwise, it will be
// sent by RemoveBrowser() when the last browser has closed.
- if (browser_shutdown::ShuttingDownWithoutClosingBrowsers() ||
- (chrome::GetTotalBrowserCount() == 0 &&
- (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive()))) {
+ if (chrome::GetTotalBrowserCount() == 0 &&
+ (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive())) {
// Tell everyone that we are shutting down.
browser_shutdown::SetTryingToQuit(true);
diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc
index 8cfd74d..3b1214b 100644
--- a/chrome/browser/ui/ash/ash_init.cc
+++ b/chrome/browser/ui/ash/ash_init.cc
@@ -11,7 +11,6 @@
#include "ash/magnifier/partial_magnification_controller.h"
#include "ash/shell.h"
#include "base/command_line.h"
-#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/lifetime/application_lifetime.h"
@@ -83,12 +82,8 @@ void OpenAsh() {
}
void CloseAsh() {
- // If shutdown is initiated by |BrowserX11IOErrorHandler|, don't
- // try to cleanup resources.
- if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers() &&
- ash::Shell::HasInstance()) {
+ if (ash::Shell::HasInstance())
ash::Shell::DeleteInstance();
- }
}
} // namespace chrome
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h
index c436b04..c1d52a4 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -51,7 +51,7 @@ class ChromeShellDelegate : public ash::ShellDelegate,
virtual bool IsIncognitoAllowed() const OVERRIDE;
virtual bool IsRunningInForcedAppMode() const OVERRIDE;
virtual void PreInit() OVERRIDE;
- virtual void Shutdown() OVERRIDE;
+ virtual void PreShutdown() OVERRIDE;
virtual void Exit() OVERRIDE;
virtual keyboard::KeyboardControllerProxy*
CreateKeyboardControllerProxy() OVERRIDE;
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
index 39ba0d3..cedcf3a 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -35,8 +35,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/ime/input_method_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
@@ -237,10 +235,8 @@ void ChromeShellDelegate::PreInit() {
new chromeos::DisplayConfigurationObserver());
}
-void ChromeShellDelegate::Shutdown() {
- content::RecordAction(base::UserMetricsAction("Shutdown"));
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- RequestShutdown();
+void ChromeShellDelegate::PreShutdown() {
+ display_configuration_observer_.reset();
}
ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
@@ -285,11 +281,6 @@ void ChromeShellDelegate::Observe(int type,
InitAfterSessionStart();
ash::Shell::GetInstance()->ShowShelf();
break;
- case chrome::NOTIFICATION_APP_TERMINATING:
- // Let classes unregister themselves as observers of the
- // ash::Shell singleton before the shell is destroyed.
- display_configuration_observer_.reset();
- break;
default:
NOTREACHED() << "Unexpected notification " << type;
}
@@ -302,7 +293,4 @@ void ChromeShellDelegate::PlatformInit() {
registrar_.Add(this,
chrome::NOTIFICATION_SESSION_STARTED,
content::NotificationService::AllSources());
- registrar_.Add(this,
- chrome::NOTIFICATION_APP_TERMINATING,
- content::NotificationService::AllSources());
}
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc
index be2e38d..3d4acc7 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc
@@ -156,7 +156,7 @@ bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
void ChromeShellDelegate::PreInit() {
}
-void ChromeShellDelegate::Shutdown() {
+void ChromeShellDelegate::PreShutdown() {
}
ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index de100f8..1051ab1 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -447,9 +447,7 @@ Browser::Browser(const CreateParams& params)
Browser::~Browser() {
// The tab strip should not have any tabs at this point.
- if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers())
- DCHECK(tab_strip_model_->empty());
-
+ DCHECK(tab_strip_model_->empty());
tab_strip_model_->RemoveObserver(this);
// Destroy the BrowserCommandController before removing the browser, so that
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
index 6f65c60..6612538 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/bookmarks/bookmark_stats.h"
-#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -893,8 +892,7 @@ void BookmarkBarGtk::BookmarkModelLoaded(BookmarkModel* model,
void BookmarkBarGtk::BookmarkModelBeingDeleted(BookmarkModel* model) {
// The bookmark model should never be deleted before us. This code exists
// to check for regressions in shutdown code and not crash.
- if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers())
- NOTREACHED();
+ NOTREACHED();
// Do minimal cleanup, presumably we'll be deleted shortly.
model_->RemoveObserver(this);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index ebaf328..aa4a15b 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -995,12 +994,7 @@ void BookmarkBarView::BookmarkModelLoaded(BookmarkModel* model,
}
void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkModel* model) {
- // In normal shutdown The bookmark model should never be deleted before us.
- // When X exits suddenly though, it can happen, This code exists
- // to check for regressions in shutdown code and not crash.
- if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers())
- NOTREACHED();
-
+ NOTREACHED();
// Do minimal cleanup, presumably we'll be deleted shortly.
model_->RemoveObserver(this);
model_ = NULL;