Commit 0fcd065d authored by Roman Aleksandrov's avatar Roman Aleksandrov Committed by Commit Bot

BaseScreen: Simplify two Skip-related methods into one.

Bug: 1064561
Change-Id: I2bc25f71de78cfe25f24b9da545e1c0baa2d9d8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2138272Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#757182}
parent c5e25e35
...@@ -26,14 +26,10 @@ void BaseScreen::Hide() { ...@@ -26,14 +26,10 @@ void BaseScreen::Hide() {
is_hidden_ = true; is_hidden_ = true;
} }
bool BaseScreen::ShouldSkipScreen() { bool BaseScreen::MaybeSkip() {
return false; return false;
} }
void BaseScreen::Skip() {
NOTREACHED() << "Skip methog should be overriden along with ShouldSkipScreen";
}
void BaseScreen::HandleUserAction(const std::string& action_id) { void BaseScreen::HandleUserAction(const std::string& action_id) {
if (is_hidden_) { if (is_hidden_) {
LOG(WARNING) << "User action came when screen is hidden: action_id=" LOG(WARNING) << "User action came when screen is hidden: action_id="
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string> #include <string>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chromeos/login/oobe_screen.h" #include "chrome/browser/chromeos/login/oobe_screen.h"
...@@ -35,11 +36,8 @@ class BaseScreen { ...@@ -35,11 +36,8 @@ class BaseScreen {
void Hide(); void Hide();
// Returns whether the screen should be skipped i. e. should be exited due to // Returns whether the screen should be skipped i. e. should be exited due to
// specific unmet conditions. Override along with Skip method. // specific unmet conditions. Returns true if skips the screen.
virtual bool ShouldSkipScreen(); virtual bool MaybeSkip() WARN_UNUSED_RESULT;
// Skips the screen. Override along with ShouldSkipScreen method.
virtual void Skip();
// Forwards user action if screen is shown. // Forwards user action if screen is shown.
void HandleUserAction(const std::string& action_id); void HandleUserAction(const std::string& action_id);
......
...@@ -58,7 +58,7 @@ void RecommendAppsScreen::OnViewDestroyed(RecommendAppsScreenView* view) { ...@@ -58,7 +58,7 @@ void RecommendAppsScreen::OnViewDestroyed(RecommendAppsScreenView* view) {
view_ = nullptr; view_ = nullptr;
} }
bool RecommendAppsScreen::ShouldSkipScreen() { bool RecommendAppsScreen::MaybeSkip() {
const user_manager::UserManager* user_manager = const user_manager::UserManager* user_manager =
user_manager::UserManager::Get(); user_manager::UserManager::Get();
DCHECK(user_manager->IsUserLoggedIn()); DCHECK(user_manager->IsUserLoggedIn());
...@@ -66,12 +66,11 @@ bool RecommendAppsScreen::ShouldSkipScreen() { ...@@ -66,12 +66,11 @@ bool RecommendAppsScreen::ShouldSkipScreen() {
->GetProfilePolicyConnector() ->GetProfilePolicyConnector()
->IsManaged(); ->IsManaged();
bool is_child_account = user_manager->IsLoggedInAsChildUser(); bool is_child_account = user_manager->IsLoggedInAsChildUser();
return is_managed_account || is_child_account; if (is_managed_account || is_child_account) {
} exit_callback_.Run(Result::NOT_APPLICABLE);
return true;
void RecommendAppsScreen::Skip() { }
DCHECK(ShouldSkipScreen()); return false;
exit_callback_.Run(Result::NOT_APPLICABLE);
} }
void RecommendAppsScreen::ShowImpl() { void RecommendAppsScreen::ShowImpl() {
......
...@@ -54,8 +54,7 @@ class RecommendAppsScreen : public BaseScreen, ...@@ -54,8 +54,7 @@ class RecommendAppsScreen : public BaseScreen,
void OnParseResponseError() override; void OnParseResponseError() override;
// BaseScreen: // BaseScreen:
bool ShouldSkipScreen() override; bool MaybeSkip() override;
void Skip() override;
private: private:
// BaseScreen: // BaseScreen:
......
...@@ -1409,10 +1409,8 @@ void WizardController::SetCurrentScreen(BaseScreen* new_current) { ...@@ -1409,10 +1409,8 @@ void WizardController::SetCurrentScreen(BaseScreen* new_current) {
if (current_screen_ == new_current || GetOobeUI() == nullptr) if (current_screen_ == new_current || GetOobeUI() == nullptr)
return; return;
if (new_current && new_current->ShouldSkipScreen()) { if (new_current && new_current->MaybeSkip())
new_current->Skip();
return; return;
}
if (current_screen_) { if (current_screen_) {
current_screen_->Hide(); current_screen_->Hide();
......
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