Commit 70b3cd8a authored by zork's avatar zork Committed by Commit bot

Move ownership of HostPairingController from PairingScreen to WizardController.

BUG=381007

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

Cr-Commit-Position: refs/heads/master@{#293838}
parent b400d928
......@@ -6,20 +6,22 @@
#include "base/command_line.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "components/pairing/bluetooth_host_pairing_controller.h"
#include "components/pairing/host_pairing_controller.h"
namespace chromeos {
using namespace host_pairing;
using namespace pairing_chromeos;
HostPairingScreen::HostPairingScreen(ScreenObserver* observer,
HostPairingScreenActor* actor)
HostPairingScreen::HostPairingScreen(
ScreenObserver* observer,
HostPairingScreenActor* actor,
pairing_chromeos::HostPairingController* controller)
: WizardScreen(observer),
actor_(actor),
controller_(controller),
current_stage_(HostPairingController::STAGE_NONE) {
actor_->SetDelegate(this);
controller_.reset(new BluetoothHostPairingController());
controller_->AddObserver(this);
}
......
......@@ -18,7 +18,8 @@ class HostPairingScreen :
public pairing_chromeos::HostPairingController::Observer,
public HostPairingScreenActor::Delegate {
public:
HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor);
HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor,
pairing_chromeos::HostPairingController* controller);
virtual ~HostPairingScreen();
private:
......@@ -50,9 +51,8 @@ class HostPairingScreen :
HostPairingScreenActor* actor_;
// Controller performing pairing. Owned by the screen for now.
// TODO(dzhioev): move to proper place later.
scoped_ptr<pairing_chromeos::HostPairingController> controller_;
// Controller performing pairing. Owned by the wizard controller.
pairing_chromeos::HostPairingController* controller_;
// Current stage of pairing process.
Stage current_stage_;
......
......@@ -74,6 +74,7 @@
#include "chromeos/settings/timezone_settings.h"
#include "components/crash/app/breakpad_linux.h"
#include "components/pairing/bluetooth_controller_pairing_controller.h"
#include "components/pairing/bluetooth_host_pairing_controller.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_types.h"
......@@ -330,8 +331,13 @@ WizardScreen* WizardController::CreateScreen(const std::string& screen_name) {
this, oobe_display_->GetControllerPairingScreenActor(),
controller_pairing_controller_.get());
} else if (screen_name == kHostPairingScreenName) {
if (!host_pairing_controller_) {
host_pairing_controller_.reset(
new pairing_chromeos::BluetoothHostPairingController());
}
return new HostPairingScreen(this,
oobe_display_->GetHostPairingScreenActor());
oobe_display_->GetHostPairingScreenActor(),
host_pairing_controller_.get());
}
return NULL;
}
......
......@@ -31,6 +31,7 @@ class DictionaryValue;
namespace pairing_chromeos {
class ControllerPairingController;
class HostPairingController;
}
namespace chromeos {
......@@ -384,6 +385,9 @@ class WizardController : public ScreenObserver, public ScreenManager {
scoped_ptr<pairing_chromeos::ControllerPairingController>
controller_pairing_controller_;
// Pairing controller for remora devices.
scoped_ptr<pairing_chromeos::HostPairingController> host_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