Commit fd162f77 authored by oshima@chromium.org's avatar oshima@chromium.org

Close notification windows while message loop is still active

Reset tooltip_controller explicitly so that timer stops at shutdown.
Use tray_ reference in SystemTrayDelegate instead of going through ash instance.
Make sure delegates doesn't access tray after the tray has been deleted.

BUG=104998
TEST=none

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=131902

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132320 0039d316-1c4b-4281-b951-d872f2087c98
parent 422a5adc
...@@ -566,6 +566,7 @@ Shell::~Shell() { ...@@ -566,6 +566,7 @@ Shell::~Shell() {
// The system tray needs to be reset before all the windows are destroyed. // The system tray needs to be reset before all the windows are destroyed.
tray_.reset(); tray_.reset();
tray_delegate_.reset();
// Desroy secondary monitor's widgets before all the windows are destroyed. // Desroy secondary monitor's widgets before all the windows are destroyed.
monitor_controller_.reset(); monitor_controller_.reset();
...@@ -588,6 +589,7 @@ Shell::~Shell() { ...@@ -588,6 +589,7 @@ Shell::~Shell() {
window_cycle_controller_.reset(); window_cycle_controller_.reset();
event_client_.reset(); event_client_.reset();
monitor_controller_.reset(); monitor_controller_.reset();
tooltip_controller_.reset();
// Launcher widget has a InputMethodBridge that references to // Launcher widget has a InputMethodBridge that references to
// input_method_filter_'s input_method_. So explicitly release launcher_ // input_method_filter_'s input_method_. So explicitly release launcher_
......
...@@ -625,22 +625,19 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -625,22 +625,19 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
void UpdateClockType(PrefService* service) { void UpdateClockType(PrefService* service) {
clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ?
base::k24HourClock : base::k12HourClock; base::k24HourClock : base::k12HourClock;
ash::ClockObserver* observer = ash::ClockObserver* observer = tray_->clock_observer();
ash::Shell::GetInstance()->tray()->clock_observer();
if (observer) if (observer)
observer->OnDateFormatChanged(); observer->OnDateFormatChanged();
} }
void NotifyRefreshClock() { void NotifyRefreshClock() {
ash::ClockObserver* observer = ash::ClockObserver* observer = tray_->clock_observer();
ash::Shell::GetInstance()->tray()->clock_observer();
if (observer) if (observer)
observer->Refresh(); observer->Refresh();
} }
void NotifyRefreshNetwork() { void NotifyRefreshNetwork() {
ash::NetworkObserver* observer = ash::NetworkObserver* observer = tray_->network_observer();
ash::Shell::GetInstance()->tray()->network_observer();
if (observer) { if (observer) {
NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
ash::NetworkIconInfo info; ash::NetworkIconInfo info;
...@@ -652,15 +649,13 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -652,15 +649,13 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
} }
void NotifyRefreshBluetooth() { void NotifyRefreshBluetooth() {
ash::BluetoothObserver* observer = ash::BluetoothObserver* observer = tray_->bluetooth_observer();
ash::Shell::GetInstance()->tray()->bluetooth_observer();
if (observer) if (observer)
observer->OnBluetoothRefresh(); observer->OnBluetoothRefresh();
} }
void NotifyRefreshIME() { void NotifyRefreshIME() {
ash::IMEObserver* observer = ash::IMEObserver* observer = tray_->ime_observer();
ash::Shell::GetInstance()->tray()->ime_observer();
if (observer) if (observer)
observer->OnIMERefresh(); observer->OnIMERefresh();
} }
...@@ -688,20 +683,18 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -688,20 +683,18 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Overridden from AudioHandler::VolumeObserver. // Overridden from AudioHandler::VolumeObserver.
virtual void OnVolumeChanged() OVERRIDE { virtual void OnVolumeChanged() OVERRIDE {
float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f; float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f;
ash::Shell::GetInstance()->tray()->audio_observer()-> tray_->audio_observer()->OnVolumeChanged(level);
OnVolumeChanged(level);
} }
// Overridden from PowerManagerClient::Observer. // Overridden from PowerManagerClient::Observer.
virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE { virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE {
ash::Shell::GetInstance()->tray()->brightness_observer()-> tray_->brightness_observer()->
OnBrightnessChanged(static_cast<double>(level), user_initiated); OnBrightnessChanged(static_cast<double>(level), user_initiated);
} }
virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE { virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE {
power_supply_status_ = power_status; power_supply_status_ = power_status;
ash::PowerStatusObserver* observer = ash::PowerStatusObserver* observer = tray_->power_status_observer();
ash::Shell::GetInstance()->tray()->power_status_observer();
if (observer) if (observer)
observer->OnPowerStatusChanged(power_status); observer->OnPowerStatusChanged(power_status);
} }
...@@ -754,8 +747,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -754,8 +747,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
virtual void OnNetworkManagerChanged(NetworkLibrary* crosnet) OVERRIDE { virtual void OnNetworkManagerChanged(NetworkLibrary* crosnet) OVERRIDE {
RefreshNetworkObserver(crosnet); RefreshNetworkObserver(crosnet);
RefreshNetworkDeviceObserver(crosnet); RefreshNetworkDeviceObserver(crosnet);
data_promo_notification_->ShowOptionalMobileDataPromoNotification(crosnet, data_promo_notification_->ShowOptionalMobileDataPromoNotification(
tray_, this); crosnet, tray_, this);
NotifyRefreshNetwork(); NotifyRefreshNetwork();
} }
...@@ -781,8 +774,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -781,8 +774,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
break; break;
} }
case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
ash::UpdateObserver* observer = ash::UpdateObserver* observer = tray_->update_observer();
ash::Shell::GetInstance()->tray()->update_observer();
if (observer) if (observer)
observer->OnUpdateRecommended(); observer->OnUpdateRecommended();
break; break;
...@@ -791,8 +783,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -791,8 +783,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// This notification is also sent on login screen when user avatar // This notification is also sent on login screen when user avatar
// is loaded from file. // is loaded from file.
if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) {
ash::UserObserver* observer = ash::UserObserver* observer = tray_->user_observer();
ash::Shell::GetInstance()->tray()->user_observer();
if (observer) if (observer)
observer->OnUserUpdate(); observer->OnUserUpdate();
} }
...@@ -808,7 +799,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -808,7 +799,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
service->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); service->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo);
} else if (pref == prefs::kSpokenFeedbackEnabled) { } else if (pref == prefs::kSpokenFeedbackEnabled) {
ash::AccessibilityObserver* observer = ash::AccessibilityObserver* observer =
ash::Shell::GetInstance()->tray()->accessibility_observer(); tray_->accessibility_observer();
if (observer) { if (observer) {
observer->OnAccessibilityModeChanged( observer->OnAccessibilityModeChanged(
service->GetBoolean(prefs::kSpokenFeedbackEnabled), service->GetBoolean(prefs::kSpokenFeedbackEnabled),
...@@ -900,8 +891,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -900,8 +891,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
search_key_mapped_to_ == input_method::kCapsLockKey) search_key_mapped_to_ == input_method::kCapsLockKey)
id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SEARCH; id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SEARCH;
ash::CapsLockObserver* observer = ash::CapsLockObserver* observer = tray_->caps_lock_observer();
ash::Shell::GetInstance()->tray()->caps_lock_observer();
if (observer) if (observer)
observer->OnCapsLockChanged(enabled, id); observer->OnCapsLockChanged(enabled, id);
} }
......
...@@ -6,9 +6,16 @@ ...@@ -6,9 +6,16 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
// static // static
void BrowserList::HandleAppExitingForPlatform() { void BrowserList::HandleAppExitingForPlatform() {
// Close All non browser windows now. Those includes notifications
// and windows created by Ash (launcher, background, etc).
g_browser_process->notification_ui_manager()->CancelAll();
// TODO(oshima): Close all non browser windows here while
// the message loop is still alive.
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) { switches::kDisableZeroBrowsersOpenForTests)) {
......
...@@ -4441,51 +4441,6 @@ ...@@ -4441,51 +4441,6 @@
fun:_ZN15tracked_objects10ThreadData11TallyADeathERKNS_6BirthsEii fun:_ZN15tracked_objects10ThreadData11TallyADeathERKNS_6BirthsEii
fun:_ZN15tracked_objects10ThreadData32TallyRunOnWorkerThreadIfTrackingEPKNS_6BirthsERKNS_11TrackedTimeES6_S6_ fun:_ZN15tracked_objects10ThreadData32TallyRunOnWorkerThreadIfTrackingEPKNS_6BirthsERKNS_11TrackedTimeES6_S6_
} }
{
bug_104998a
Memcheck:Leak
fun:_Znw*
...
fun:_ZN16SiteInstanceImpl10GetProcessEv
...
fun:_ZN21RenderViewHostFactory6CreateEPN7content12SiteInstanceEPNS0_22RenderViewHostDelegate*SessionStorageNamespace*
fun:_ZN21RenderViewHostManager4InitEPN7content14BrowserContextEPNS0_12SiteInstanceEi
fun:_ZN15WebContentsImplC1EPN7content14BrowserContextEPNS0_12SiteInstance*SessionStorageNamespace*
fun:_ZN7content11WebContents6CreateEPNS_14BrowserContextEPNS_12SiteInstance*SessionStorageNamespace*
fun:_ZN11BalloonHost4InitEv
}
{
bug_104998c
Memcheck:Leak
fun:_Znw*
fun:_ZN20ChildProcessLauncherC1EbRKSt6vectorISt4pairISsSsESaIS2_EEiP11CommandLinePNS_6ClientE
fun:_ZN21RenderProcessHostImpl4InitEb
...
fun:_ZN21RenderViewHostManager14InitRenderView*
fun:_ZN21RenderViewHostManager8NavigateERKN7content19NavigationEntryImplE
fun:_ZN15WebContentsImpl15NavigateToEntryERKN7content19NavigationEntryImplENS0_20NavigationController10ReloadTypeE
fun:_ZN15WebContentsImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl9LoadEntryEPN7content19NavigationEntryImplE
fun:_ZN24NavigationControllerImpl7LoadURLERK4GURLRKN7content8ReferrerENS3_14PageTransitionERKSs
fun:_ZN11BalloonHost4InitEv
}
{
bug_104998d
Memcheck:Leak
fun:_Znw*
fun:_ZN21RenderProcessHostImpl4InitEb
...
fun:_ZN15WebContentsImpl32CreateRenderViewForRenderManager*
fun:_ZN21RenderViewHostManager14InitRenderView*
fun:_ZN21RenderViewHostManager8NavigateERKN7content19NavigationEntryImplE
fun:_ZN15WebContentsImpl15NavigateToEntryERKN7content19NavigationEntryImplENS0_20NavigationController10ReloadTypeE
fun:_ZN15WebContentsImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl22NavigateToPendingEntryEN7content20NavigationController10ReloadTypeE
fun:_ZN24NavigationControllerImpl9LoadEntryEPN7content19NavigationEntryImplE
fun:_ZN24NavigationControllerImpl7LoadURLERK4GURLRKN7content8ReferrerENS3_14PageTransitionERKSs
fun:_ZN11BalloonHost4InitEv
}
{ {
bug_105715 bug_105715
Memcheck:Uninitialized Memcheck:Uninitialized
......
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