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 @@ ...@@ -6,20 +6,22 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/browser/chromeos/login/wizard_controller.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 { namespace chromeos {
using namespace host_pairing; using namespace host_pairing;
using namespace pairing_chromeos; using namespace pairing_chromeos;
HostPairingScreen::HostPairingScreen(ScreenObserver* observer, HostPairingScreen::HostPairingScreen(
HostPairingScreenActor* actor) ScreenObserver* observer,
HostPairingScreenActor* actor,
pairing_chromeos::HostPairingController* controller)
: WizardScreen(observer), : WizardScreen(observer),
actor_(actor), actor_(actor),
controller_(controller),
current_stage_(HostPairingController::STAGE_NONE) { current_stage_(HostPairingController::STAGE_NONE) {
actor_->SetDelegate(this); actor_->SetDelegate(this);
controller_.reset(new BluetoothHostPairingController());
controller_->AddObserver(this); controller_->AddObserver(this);
} }
......
...@@ -18,7 +18,8 @@ class HostPairingScreen : ...@@ -18,7 +18,8 @@ class HostPairingScreen :
public pairing_chromeos::HostPairingController::Observer, public pairing_chromeos::HostPairingController::Observer,
public HostPairingScreenActor::Delegate { public HostPairingScreenActor::Delegate {
public: public:
HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor); HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor,
pairing_chromeos::HostPairingController* controller);
virtual ~HostPairingScreen(); virtual ~HostPairingScreen();
private: private:
...@@ -50,9 +51,8 @@ class HostPairingScreen : ...@@ -50,9 +51,8 @@ class HostPairingScreen :
HostPairingScreenActor* actor_; HostPairingScreenActor* 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::HostPairingController* controller_;
scoped_ptr<pairing_chromeos::HostPairingController> controller_;
// Current stage of pairing process. // Current stage of pairing process.
Stage current_stage_; Stage current_stage_;
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#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/pairing/bluetooth_controller_pairing_controller.h"
#include "components/pairing/bluetooth_host_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"
...@@ -330,8 +331,13 @@ WizardScreen* WizardController::CreateScreen(const std::string& screen_name) { ...@@ -330,8 +331,13 @@ WizardScreen* WizardController::CreateScreen(const std::string& screen_name) {
this, oobe_display_->GetControllerPairingScreenActor(), this, oobe_display_->GetControllerPairingScreenActor(),
controller_pairing_controller_.get()); controller_pairing_controller_.get());
} else if (screen_name == kHostPairingScreenName) { } else if (screen_name == kHostPairingScreenName) {
if (!host_pairing_controller_) {
host_pairing_controller_.reset(
new pairing_chromeos::BluetoothHostPairingController());
}
return new HostPairingScreen(this, return new HostPairingScreen(this,
oobe_display_->GetHostPairingScreenActor()); oobe_display_->GetHostPairingScreenActor(),
host_pairing_controller_.get());
} }
return NULL; return NULL;
} }
......
...@@ -31,6 +31,7 @@ class DictionaryValue; ...@@ -31,6 +31,7 @@ class DictionaryValue;
namespace pairing_chromeos { namespace pairing_chromeos {
class ControllerPairingController; class ControllerPairingController;
class HostPairingController;
} }
namespace chromeos { namespace chromeos {
...@@ -384,6 +385,9 @@ class WizardController : public ScreenObserver, public ScreenManager { ...@@ -384,6 +385,9 @@ class WizardController : public ScreenObserver, public ScreenManager {
scoped_ptr<pairing_chromeos::ControllerPairingController> scoped_ptr<pairing_chromeos::ControllerPairingController>
controller_pairing_controller_; 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. // 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