Commit 9d05f003 authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Commit Bot

[USB enrollment] Add Configuration to OOBE Screens.

TBR=alemate@chromium.org

Bug: 854101
Change-Id: I4792b0bef59a71d6628da8337043f00ca4b0e5b2
Reviewed-on: https://chromium-review.googlesource.com/1069268Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
Commit-Queue: Denis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570708}
parent 90975d64
...@@ -119,4 +119,8 @@ void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) { ...@@ -119,4 +119,8 @@ void BaseScreen::OnContextChanged(const base::DictionaryValue& diff) {
OnContextKeyUpdated(key); OnContextKeyUpdated(key);
} }
void BaseScreen::SetConfiguration(base::DictionaryValue* configuration) {
configuration_ = configuration;
}
} // namespace chromeos } // namespace chromeos
...@@ -68,6 +68,8 @@ class BaseScreen { ...@@ -68,6 +68,8 @@ class BaseScreen {
void set_model_view_channel(ModelViewChannel* channel) { channel_ = channel; } void set_model_view_channel(ModelViewChannel* channel) { channel_ = channel; }
virtual void SetConfiguration(base::DictionaryValue* configuration);
protected: protected:
// Scoped context editor, which automatically commits all pending // Scoped context editor, which automatically commits all pending
// context changes on destruction. // context changes on destruction.
...@@ -114,6 +116,16 @@ class BaseScreen { ...@@ -114,6 +116,16 @@ class BaseScreen {
// current BaseScreen instance. // current BaseScreen instance.
ContextEditor GetContextEditor(); ContextEditor GetContextEditor();
// Global configuration for OOBE screens, that can be used to automate some
// screens.
// Screens can use values in Configuration to fill in UI values or
// automatically finish.
// Configuration is guaranteed to exist between pair of OnShow/OnHide calls,
// no external changes will be made to configuration during that time.
// Do not confuse it with Context, which is a way to communicate with
// JS-based UI part of the screen.
base::DictionaryValue* GetConfiguration() const { return configuration_; }
BaseScreenDelegate* get_base_screen_delegate() const { BaseScreenDelegate* get_base_screen_delegate() const {
return base_screen_delegate_; return base_screen_delegate_;
} }
...@@ -142,6 +154,8 @@ class BaseScreen { ...@@ -142,6 +154,8 @@ class BaseScreen {
// counterpart. // counterpart.
void OnContextChanged(const base::DictionaryValue& diff); void OnContextChanged(const base::DictionaryValue& diff);
base::DictionaryValue* configuration_ = nullptr;
ModelViewChannel* channel_ = nullptr; ModelViewChannel* channel_ = nullptr;
BaseScreenDelegate* base_screen_delegate_ = nullptr; BaseScreenDelegate* base_screen_delegate_ = nullptr;
......
...@@ -21,6 +21,7 @@ class MockWelcomeScreen : public WelcomeScreen { ...@@ -21,6 +21,7 @@ class MockWelcomeScreen : public WelcomeScreen {
MOCK_METHOD0(Show, void()); MOCK_METHOD0(Show, void());
MOCK_METHOD0(Hide, void()); MOCK_METHOD0(Hide, void());
MOCK_METHOD1(SetConfiguration, void(base::DictionaryValue* configuration));
}; };
class MockWelcomeView : public WelcomeView { class MockWelcomeView : public WelcomeView {
......
...@@ -268,7 +268,10 @@ bool WizardController::zero_delay_enabled_ = false; ...@@ -268,7 +268,10 @@ bool WizardController::zero_delay_enabled_ = false;
PrefService* WizardController::local_state_for_testing_ = nullptr; PrefService* WizardController::local_state_for_testing_ = nullptr;
WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui) WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui)
: host_(host), oobe_ui_(oobe_ui), weak_factory_(this) { : host_(host),
oobe_ui_(oobe_ui),
oobe_configuration_(new base::DictionaryValue()),
weak_factory_(this) {
DCHECK(default_controller_ == nullptr); DCHECK(default_controller_ == nullptr);
default_controller_ = this; default_controller_ = this;
screen_manager_ = std::make_unique<ScreenManager>(this); screen_manager_ = std::make_unique<ScreenManager>(this);
...@@ -1109,6 +1112,7 @@ void WizardController::ShowCurrentScreen() { ...@@ -1109,6 +1112,7 @@ void WizardController::ShowCurrentScreen() {
smooth_show_timer_.Stop(); smooth_show_timer_.Stop();
UpdateStatusAreaVisibilityForScreen(current_screen_->screen_id()); UpdateStatusAreaVisibilityForScreen(current_screen_->screen_id());
current_screen_->SetConfiguration(oobe_configuration_.get());
current_screen_->Show(); current_screen_->Show();
} }
...@@ -1123,8 +1127,10 @@ void WizardController::SetCurrentScreenSmooth(BaseScreen* new_current, ...@@ -1123,8 +1127,10 @@ void WizardController::SetCurrentScreenSmooth(BaseScreen* new_current,
smooth_show_timer_.Stop(); smooth_show_timer_.Stop();
if (current_screen_) if (current_screen_) {
current_screen_->Hide(); current_screen_->Hide();
current_screen_->SetConfiguration(nullptr);
}
const OobeScreen screen = new_current->screen_id(); const OobeScreen screen = new_current->screen_id();
if (IsOOBEStepToTrack(screen)) if (IsOOBEStepToTrack(screen))
......
...@@ -444,6 +444,9 @@ class WizardController : public BaseScreenDelegate, ...@@ -444,6 +444,9 @@ class WizardController : public BaseScreenDelegate,
std::unique_ptr<pairing_chromeos::SharkConnectionListener> std::unique_ptr<pairing_chromeos::SharkConnectionListener>
shark_connection_listener_; shark_connection_listener_;
// Configuration for automating OOBE screens.
std::unique_ptr<base::DictionaryValue> oobe_configuration_;
BaseScreen* hid_screen_ = nullptr; BaseScreen* hid_screen_ = nullptr;
base::WeakPtrFactory<WizardController> weak_factory_; base::WeakPtrFactory<WizardController> weak_factory_;
......
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