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