0

Reland "lobster: use the lobster enterprise policy pref to control feedback visibility"

This is a reland of commit 0b831b2f1c

Original change's description:
> lobster: use the lobster enterprise policy pref to control feedback visibility
>
> This CL adds a logic to enable feedback if the policy value = 0.
>
> Bug: b:383213184
> Change-Id: Iae84b890a373463230701e1853030106611d0800
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6275151
> Reviewed-by: Grey Wang <greywang@google.com>
> Commit-Queue: Chuong Ho <hdchuong@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1421690}

Bug: b:383213184
Change-Id: I36c688e46ae09e023c5bacdc6dc773dcd0e40d57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6285285
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Grey Wang <greywang@google.com>
Commit-Queue: Chuong Ho <hdchuong@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423456}
This commit is contained in:
Chuong Ho
2025-02-21 15:32:49 -08:00
committed by Chromium LUCI CQ
parent effa1d6cf0
commit 15d62935bb
5 changed files with 17 additions and 7 deletions

@ -218,7 +218,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry,
registry->RegisterBooleanPref(prefs::kOrcaEnabled, true);
registry->RegisterBooleanPref(prefs::kOrcaFeedbackEnabled, true);
registry->RegisterBooleanPref(prefs::kLobsterEnabled, true);
registry->RegisterBooleanPref(
registry->RegisterIntegerPref(
prefs::kLobsterEnterprisePolicySettings,
base::to_underlying(
ash::LobsterEnterprisePolicyValue::kAllowedWithModelImprovement));

@ -27,7 +27,8 @@ LobsterBubbleCoordinator::~LobsterBubbleCoordinator() {
void LobsterBubbleCoordinator::LoadUI(Profile* profile,
std::optional<std::string_view> query,
LobsterMode mode,
const gfx::Rect& caret_bounds) {
const gfx::Rect& caret_bounds,
bool should_show_feedback_ui) {
if (IsShowingUI()) {
contents_wrapper_->CloseUI();
}
@ -46,8 +47,7 @@ void LobsterBubbleCoordinator::LoadUI(Profile* profile,
url = net::AppendOrReplaceQueryParameter(
url, kLobsterFeedbackEnabledParamKey,
base::FeatureList::IsEnabled(ash::features::kLobsterFeedback) ? "true"
: "false");
should_show_feedback_ui ? "true" : "false");
contents_wrapper_ = std::make_unique<WebUIContentsWrapperT<MakoUntrustedUI>>(
url, profile, IDS_ACCNAME_ORCA,

@ -29,7 +29,8 @@ class LobsterBubbleCoordinator : public views::WidgetObserver {
void LoadUI(Profile* profile,
std::optional<std::string_view> query,
LobsterMode mode,
const gfx::Rect& caret_bounds);
const gfx::Rect& caret_bounds,
bool should_show_feedback_ui);
void ShowUI();
void CloseUI();

@ -8,8 +8,10 @@
#include <string>
#include <utility>
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/lobster/lobster_enums.h"
#include "ash/public/cpp/lobster/lobster_session.h"
#include "base/check_deref.h"
#include "base/command_line.h"
@ -124,7 +126,14 @@ void LobsterService::ShowDisclaimerUI() {
void LobsterService::LoadUI(std::optional<std::string> query,
ash::LobsterMode mode,
const gfx::Rect& caret_bounds) {
bubble_coordinator_.LoadUI(profile_, query, mode, caret_bounds);
bubble_coordinator_.LoadUI(
profile_, query, mode, caret_bounds,
/*should_show_feedback=*/
profile_->GetPrefs()->GetInteger(
ash::prefs::kLobsterEnterprisePolicySettings) ==
base::to_underlying(ash::LobsterEnterprisePolicyValue::
kAllowedWithModelImprovement) &&
base::FeatureList::IsEnabled(ash::features::kLobsterFeedback));
}
void LobsterService::ShowUI() {

@ -288,7 +288,7 @@ void Preferences::RegisterProfilePrefs(
registry->RegisterBooleanPref(prefs::kOrcaFeedbackEnabled, true);
registry->RegisterBooleanPref(prefs::kManagedOrcaEnabled, true);
registry->RegisterBooleanPref(prefs::kLobsterEnabled, true);
registry->RegisterBooleanPref(
registry->RegisterIntegerPref(
prefs::kLobsterEnterprisePolicySettings,
base::to_underlying(
ash::LobsterEnterprisePolicyValue::kAllowedWithModelImprovement));