Commit d304ade7 authored by Thanh Nguyen's avatar Thanh Nguyen Committed by Commit Bot

Update condition to to show app reinstall recommendations

App reinstall recommendations should only be shown if suggested content
flag is enabled.

Bug: 1028373
Change-Id: Ic0dead9396634715c89cd85f284b41a55a78b08e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440200Reviewed-by: default avatarRachel Wong <wrong@chromium.org>
Reviewed-by: default avatarJia Meng <jiameng@chromium.org>
Commit-Queue: Thanh Nguyen <thanhdng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812587}
parent 2bac0dce
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chrome/browser/ui/app_list/search/chrome_search_result.h" #include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/browser/ui/app_list/search/common/url_icon_source.h" #include "chrome/browser/ui/app_list/search/common/url_icon_source.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_pref_names.h" #include "chromeos/constants/chromeos_pref_names.h"
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
#include "components/arc/session/arc_bridge_service.h" #include "components/arc/session/arc_bridge_service.h"
...@@ -259,9 +260,16 @@ void ArcAppReinstallSearchProvider::Start(const base::string16& query) { ...@@ -259,9 +260,16 @@ void ArcAppReinstallSearchProvider::Start(const base::string16& query) {
// Always check if suggested content is enabled before searching for // Always check if suggested content is enabled before searching for
// reinstall recommendations. // reinstall recommendations.
bool should_show_arc_app_reinstall_result = true;
PrefService* pref_service = profile_->GetPrefs(); PrefService* pref_service = profile_->GetPrefs();
if (pref_service && if (pref_service &&
!pref_service->GetBoolean(chromeos::prefs::kSuggestedContentEnabled)) { !pref_service->GetBoolean(chromeos::prefs::kSuggestedContentEnabled))
should_show_arc_app_reinstall_result = false;
if (!base::FeatureList::IsEnabled(
chromeos::features::kSuggestedContentToggle))
should_show_arc_app_reinstall_result = false;
if (!should_show_arc_app_reinstall_result) {
ClearResults(); ClearResults();
return; return;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/arc/mojom/app.mojom.h" #include "components/arc/mojom/app.mojom.h"
#include "components/arc/test/fake_app_instance.h" #include "components/arc/test/fake_app_instance.h"
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
...@@ -203,6 +204,9 @@ TEST_F(ArcAppReinstallSearchProviderTest, TestPolicyManagedUser) { ...@@ -203,6 +204,9 @@ TEST_F(ArcAppReinstallSearchProviderTest, TestPolicyManagedUser) {
} }
TEST_F(ArcAppReinstallSearchProviderTest, TestResultsWithSearchChanged) { TEST_F(ArcAppReinstallSearchProviderTest, TestResultsWithSearchChanged) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chromeos::features::kSuggestedContentToggle);
std::vector<arc::mojom::AppReinstallCandidatePtr> candidates; std::vector<arc::mojom::AppReinstallCandidatePtr> candidates;
candidates.emplace_back(arc::mojom::AppReinstallCandidate::New( candidates.emplace_back(arc::mojom::AppReinstallCandidate::New(
"com.package.fakepackage1", "Title of first package", "com.package.fakepackage1", "Title of first package",
......
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