Commit d2a15e8b authored by Yue Li's avatar Yue Li Committed by Commit Bot

Check session state when showing Assistant opt-in dialog

In order to prevent corner cases/timing issue related to session state
change, adding a check when showing the opt-in dialog.

Bug: 978267
Test: Run existing tests
Change-Id: I9f84e5fc90ba8d50407fa44a29749406ae1b2db0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1717464Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681062}
parent 718e5834
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h"
#include "content/public/browser/host_zoom_map.h" #include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/url_data_source.h" #include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
...@@ -118,6 +119,12 @@ void AssistantOptInUI::Initialize() { ...@@ -118,6 +119,12 @@ void AssistantOptInUI::Initialize() {
void AssistantOptInDialog::Show( void AssistantOptInDialog::Show(
ash::FlowType type, ash::FlowType type,
ash::AssistantSetup::StartAssistantOptInFlowCallback callback) { ash::AssistantSetup::StartAssistantOptInFlowCallback callback) {
// Check session state here to prevent timing issue -- session state might
// have changed during the mojom calls to launch the opt-in dalog.
if (session_manager::SessionManager::Get()->session_state() !=
session_manager::SessionState::ACTIVE) {
return;
}
if (g_dialog) { if (g_dialog) {
g_dialog->Focus(); g_dialog->Focus();
std::move(callback).Run(false); std::move(callback).Run(false);
......
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