forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interface for Supervision Onboarding flow.
This flow is triggered at the end of the OOBE/Login for supervised accounts. It will show a series of pages that will be fetched from families.google.com and displayed in a webview. This flow will be triggered from a custom WebUI in the future, so we also add a common mojo interface that can be used in both WebUIs. For more context about this flow, see the documents linked in the bug. Added as reviewers: - sky@ for chrome/app/BUILD.gn - alemate@ for chromeos/login - stevenjb@ for chromeos/supervision - kerrnel for mojom and chrome/app/*_manifest.cc Bug: 958995 Change-Id: I8dc11d6a1d9c645cbaaeac18013d81f73f9add31 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599924 Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Greg Kerr <kerrnel@chromium.org> Reviewed-by: Alexander Alekseev <alemate@chromium.org> Reviewed-by: Steven Bennetts <stevenjb@chromium.org> Commit-Queue: Lucas Tenório <ltenorio@chromium.org> Cr-Commit-Position: refs/heads/master@{#658354}
- Loading branch information
Lucas Tenório
authored and
Commit Bot
committed
May 10, 2019
1 parent
cd54ad1
commit ffa543e
Showing
21 changed files
with
272 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
agawronska@chromium.org | ||
brunoad@chromium.org | ||
hgrandinetti@chromium.org | ||
ltenorio@chromium.org | ||
michaelpg@chromium.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2019 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//mojo/public/tools/bindings/mojom.gni") | ||
|
||
mojom("mojom") { | ||
sources = [ | ||
"onboarding_controller.mojom", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
per-file *.mojom=set noparent | ||
per-file *.mojom=file://ipc/SECURITY_OWNERS |
45 changes: 45 additions & 0 deletions
45
chrome/browser/chromeos/supervision/mojom/onboarding_controller.mojom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module chromeos.supervision.mojom; | ||
|
||
// Represents user actions that the OnboardingController can handle. | ||
enum OnboardingFlowAction { | ||
// The user has expressed intent to skip the remaining screens of the flow. | ||
// When receiving this we will most likely perform cleanup functions and | ||
// order the WebviewHost to exit the flow. | ||
kSkipFlow, | ||
|
||
// The user wants to go back/forward in the flow. | ||
kShowNextPage, | ||
kShowPreviousPage, | ||
}; | ||
|
||
|
||
// Represents a webview host, responsible for displaying supervision | ||
// onboarding pages. This will usually be a WebUI page that contains a | ||
// webview tag and manages its properties. | ||
// TODO(958995): Complete this interface. | ||
interface OnboardingWebviewHost { | ||
// Requests that the webview load the page with the given url. | ||
LoadPage(string url); | ||
|
||
// Requests that the host exit the flow immediately. This might mean | ||
// different things depending on the type of host. If we are running in the | ||
// OOBE we will exit the supervision screen and move the the next OOBE step, | ||
// if we are running in a custom WebUI, we should close it. | ||
ExitFlow(); | ||
}; | ||
|
||
// Interface responsible for managing the whole onboarding flow. | ||
// TODO(958995): Complete this interface. | ||
interface OnboardingController { | ||
// Binds the given webview host to this controller. The host will start | ||
// receiving commands as soon as this is called. | ||
BindWebviewHost(OnboardingWebviewHost webview_host); | ||
|
||
// Requests the controller to handle the given action. | ||
// The controller will decide the next step to continue/end the flow. | ||
HandleAction(OnboardingFlowAction action); | ||
}; |
51 changes: 51 additions & 0 deletions
51
chrome/browser/chromeos/supervision/onboarding_controller_impl.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/chromeos/supervision/onboarding_controller_impl.h" | ||
|
||
#include "base/command_line.h" | ||
#include "base/logging.h" | ||
#include "chromeos/constants/chromeos_switches.h" | ||
|
||
namespace chromeos { | ||
namespace supervision { | ||
|
||
OnboardingControllerImpl::OnboardingControllerImpl() = default; | ||
OnboardingControllerImpl::~OnboardingControllerImpl() = default; | ||
|
||
void OnboardingControllerImpl::BindRequest( | ||
mojom::OnboardingControllerRequest request) { | ||
bindings_.AddBinding(this, std::move(request)); | ||
} | ||
|
||
void OnboardingControllerImpl::BindWebviewHost( | ||
mojom::OnboardingWebviewHostPtr webview_host) { | ||
webview_host_ = std::move(webview_host); | ||
|
||
std::string start_page_url = | ||
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | ||
chromeos::switches::kSupervisionOnboardingStartPageUrl); | ||
if (start_page_url.empty()) { | ||
webview_host_->ExitFlow(); | ||
return; | ||
} | ||
|
||
webview_host_->LoadPage(start_page_url); | ||
} | ||
|
||
void OnboardingControllerImpl::HandleAction( | ||
mojom::OnboardingFlowAction action) { | ||
DCHECK(webview_host_); | ||
switch (action) { | ||
// TODO(958985): Implement the full flow state machine. | ||
case mojom::OnboardingFlowAction::kSkipFlow: | ||
case mojom::OnboardingFlowAction::kShowNextPage: | ||
case mojom::OnboardingFlowAction::kShowPreviousPage: | ||
webview_host_->ExitFlow(); | ||
return; | ||
} | ||
} | ||
|
||
} // namespace supervision | ||
} // namespace chromeos |
39 changes: 39 additions & 0 deletions
39
chrome/browser/chromeos/supervision/onboarding_controller_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_CHROMEOS_SUPERVISION_ONBOARDING_CONTROLLER_IMPL_H_ | ||
#define CHROME_BROWSER_CHROMEOS_SUPERVISION_ONBOARDING_CONTROLLER_IMPL_H_ | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include "base/macros.h" | ||
#include "chrome/browser/chromeos/supervision/mojom/onboarding_controller.mojom.h" | ||
#include "mojo/public/cpp/bindings/binding_set.h" | ||
|
||
namespace chromeos { | ||
namespace supervision { | ||
|
||
class OnboardingControllerImpl : public mojom::OnboardingController { | ||
public: | ||
OnboardingControllerImpl(); | ||
~OnboardingControllerImpl() override; | ||
|
||
void BindRequest(mojom::OnboardingControllerRequest request); | ||
|
||
private: | ||
// mojom::OnboardingController: | ||
void BindWebviewHost(mojom::OnboardingWebviewHostPtr webview_host) override; | ||
void HandleAction(mojom::OnboardingFlowAction action) override; | ||
|
||
mojom::OnboardingWebviewHostPtr webview_host_; | ||
mojo::BindingSet<mojom::OnboardingController> bindings_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(OnboardingControllerImpl); | ||
}; | ||
|
||
} // namespace supervision | ||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_CHROMEOS_SUPERVISION_ONBOARDING_CONTROLLER_IMPL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.