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

Check Assistant allowed state for the opt-in flow

Bug: b/143516594
Test: Manual Test
Change-Id: I42251a3b7c97723c7eeb2f0267dbdc72a8fee66c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888651Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710914}
parent 463020da
......@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "build/buildflag.h"
#include "chrome/browser/chromeos/assistant/assistant_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/ash_util.h"
......@@ -139,6 +140,14 @@ void AssistantOptInDialog::Show(
return;
#endif
// Check Assistant allowed state.
if (::assistant::IsAssistantAllowedForProfile(
ProfileManager::GetActiveUserProfile()) !=
ash::mojom::AssistantAllowedState::ALLOWED) {
std::move(callback).Run(false);
return;
}
// 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() !=
......
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