Skip to content
Snippets Groups Projects
Commit 4f02fd22 authored by avayvod@chromium.org's avatar avayvod@chromium.org
Browse files

Clean up when Chrome is terminated and WizardController is in charge of the message loop.

BUG=chromium-os:7295
TEST=Login with a new user, lock screen on profile picture step, sign out, login as the same user, verify there's no crash infobar shown.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68344 0039d316-1c4b-4281-b951-d872f2087c98
parent 2d0f89a1
No related merge requests found
......@@ -46,6 +46,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "cros/chromeos_wm_ipc_enums.h"
#include "unicode/timezone.h"
......@@ -266,6 +267,10 @@ WizardController::WizardController()
observer_(NULL) {
DCHECK(default_controller_ == NULL);
default_controller_ = this;
registrar_.Add(
this,
NotificationType::APP_TERMINATING,
NotificationService::AllSources());
}
WizardController::~WizardController() {
......@@ -513,6 +518,18 @@ void WizardController::SkipRegistration() {
LOG(ERROR) << "Registration screen is not active.";
}
void WizardController::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
CHECK(type == NotificationType::APP_TERMINATING);
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
MessageLoop::current()->Quit();
registrar_.Remove(this,
NotificationType::APP_TERMINATING,
NotificationService::AllSources());
}
// static
void WizardController::RegisterPrefs(PrefService* local_state) {
local_state->RegisterBooleanPref(kOobeComplete, false);
......
......@@ -13,6 +13,8 @@
#include "chrome/browser/chromeos/login/screen_observer.h"
#include "chrome/browser/chromeos/login/view_screen.h"
#include "chrome/browser/chromeos/login/wizard_screen.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/rect.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
......@@ -48,7 +50,8 @@ class WidgetGtk;
// Class that manages control flow between wizard screens. Wizard controller
// interacts with screen controllers to move the user between screens.
class WizardController : public chromeos::ScreenObserver,
public WizardScreenDelegate {
public WizardScreenDelegate,
public NotificationObserver {
public:
WizardController();
~WizardController();
......@@ -159,6 +162,11 @@ class WizardController : public chromeos::ScreenObserver,
static const char kEulaScreenName[];
static const char kHTMLPageScreenName[];
// NotificationObserver implementation:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
private:
// Exit handlers:
void OnLoginSignInSelected();
......@@ -268,6 +276,8 @@ class WizardController : public chromeos::ScreenObserver,
// URL to open on browser launch.
GURL start_url_;
NotificationRegistrar registrar_;
FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorNetwork);
FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorUpdate);
FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowEulaDeclined);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment