Commit c60975f9 authored by Zach Kuznia's avatar Zach Kuznia

Move ownership of the ControllerPairingController into the WizardController.

BUG=None
R=achuith@chromium.org, zelidrag@chromium.org

Review URL: https://codereview.chromium.org/539733002

Cr-Commit-Position: refs/heads/master@{#293337}
parent e139d98e
......@@ -7,7 +7,6 @@
#include "base/command_line.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "components/pairing/bluetooth_controller_pairing_controller.h"
#include "google_apis/gaia/gaia_auth_util.h"
using namespace chromeos::controller_pairing;
......@@ -21,13 +20,14 @@ namespace chromeos {
ControllerPairingScreen::ControllerPairingScreen(
ScreenObserver* observer,
ControllerPairingScreenActor* actor)
ControllerPairingScreenActor* actor,
ControllerPairingController* controller)
: WizardScreen(observer),
actor_(actor),
controller_(controller),
current_stage_(ControllerPairingController::STAGE_NONE),
device_preselected_(false) {
actor_->SetDelegate(this);
controller_.reset(new BluetoothControllerPairingController());
controller_->AddObserver(this);
}
......
......@@ -19,8 +19,10 @@ class ControllerPairingScreen :
public pairing_chromeos::ControllerPairingController::Observer,
public ControllerPairingScreenActor::Delegate {
public:
ControllerPairingScreen(ScreenObserver* observer,
ControllerPairingScreenActor* actor);
ControllerPairingScreen(
ScreenObserver* observer,
ControllerPairingScreenActor* actor,
pairing_chromeos::ControllerPairingController* controller);
virtual ~ControllerPairingScreen();
private:
......@@ -51,9 +53,8 @@ class ControllerPairingScreen :
ControllerPairingScreenActor* actor_;
// Controller performing pairing. Owned by the screen for now.
// TODO(dzhioev): move to proper place later.
scoped_ptr<pairing_chromeos::ControllerPairingController> controller_;
// Controller performing pairing. Owned by the wizard controller.
pairing_chromeos::ControllerPairingController* controller_;
// Current stage of pairing process.
Stage current_stage_;
......
......@@ -73,6 +73,7 @@
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/settings/timezone_settings.h"
#include "components/crash/app/breakpad_linux.h"
#include "components/pairing/bluetooth_controller_pairing_controller.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_types.h"
......@@ -362,8 +363,13 @@ WizardScreen* WizardController::CreateScreen(const std::string& screen_name) {
return new chromeos::AutoEnrollmentCheckScreen(
this, oobe_display_->GetAutoEnrollmentCheckScreenActor());
} else if (screen_name == kControllerPairingScreenName) {
if (!controller_pairing_controller_) {
controller_pairing_controller_.reset(
new pairing_chromeos::BluetoothControllerPairingController());
}
return new ControllerPairingScreen(
this, oobe_display_->GetControllerPairingScreenActor());
this, oobe_display_->GetControllerPairingScreenActor(),
controller_pairing_controller_.get());
} else if (screen_name == kHostPairingScreenName) {
return new HostPairingScreen(this,
oobe_display_->GetHostPairingScreenActor());
......
......@@ -28,6 +28,10 @@ namespace base {
class DictionaryValue;
}
namespace pairing_chromeos {
class ControllerPairingController;
}
namespace chromeos {
class AutoEnrollmentCheckScreen;
......@@ -388,6 +392,10 @@ class WizardController : public ScreenObserver {
scoped_ptr<SimpleGeolocationProvider> geolocation_provider_;
scoped_ptr<TimeZoneProvider> timezone_provider_;
// Pairing controller for shark devices.
scoped_ptr<pairing_chromeos::ControllerPairingController>
controller_pairing_controller_;
// Maps screen ids to last time of their shows.
base::hash_map<std::string, base::Time> screen_show_times_;
......
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