Skip to content

Commit

Permalink
[M103][Crow] Add crow capability to feed request.
Browse files Browse the repository at this point in the history
(cherry picked from commit abf7d0f)

Bug: 1321709
Change-Id: Ibd8a601d22e830e362fcd4e34168c3d605f91065
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3636865
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Dan H <harringtond@chromium.org>
Reviewed-by: Travis Skare <skare@chromium.org>
Commit-Queue: Sophey Dong <sophey@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1003036}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3687981
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/branch-heads/5060@{#648}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Sophey authored and Chromium LUCI CQ committed Jun 7, 2022
1 parent d5491a6 commit 471e7eb
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions chrome/browser/component_updater/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include_rules = [
"+chrome/browser/share",
"+chrome/updater",
"+components/cdm/common",
"+components/feed",
"+components/live_caption",
"+components/soda",
"+media/cdm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "chrome/browser/flags/android/chrome_feature_list.h"
#include "components/component_updater/component_installer.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/feed/feed_feature_list.h"

using component_updater::ComponentUpdateService;

Expand Down Expand Up @@ -125,7 +126,7 @@ CrowDomainListComponentInstallerPolicy::GetInstallerAttributes() const {
}

void RegisterCrowDomainListComponent(ComponentUpdateService* cus) {
if (!base::FeatureList::IsEnabled(chrome::android::kShareCrowButton)) {
if (!base::FeatureList::IsEnabled(feed::kShareCrowButton)) {
return;
}

Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/flags/android/chrome_feature_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const base::Feature* const kFeaturesExposedToJava[] = {
&feed::kInterestFeedV2,
&feed::kInterestFeedV2Autoplay,
&feed::kInterestFeedV2Hearts,
&feed::kShareCrowButton,
&feed::kReliabilityLogging,
&feed::kWebFeed,
&feed::kWebFeedAwareness,
Expand Down Expand Up @@ -267,7 +268,6 @@ const base::Feature* const kFeaturesExposedToJava[] = {
&kServiceManagerForBackgroundPrefetch,
&kServiceManagerForDownload,
&kShareButtonInTopToolbar,
&kShareCrowButton,
&kSharedClipboardUI,
&kShowScrollableMVTOnNTPAndroid,
&kSpannableInlineAutocomplete,
Expand Down Expand Up @@ -741,9 +741,6 @@ const base::Feature kServiceManagerForDownload{
const base::Feature kShareButtonInTopToolbar{"ShareButtonInTopToolbar",
base::FEATURE_DISABLED_BY_DEFAULT};

const base::Feature kShareCrowButton{"ShareCrowButton",
base::FEATURE_DISABLED_BY_DEFAULT};

const base::Feature kShowScrollableMVTOnNTPAndroid{
"ShowScrollableMVTOnNTPAndroid", base::FEATURE_DISABLED_BY_DEFAULT};

Expand Down
1 change: 0 additions & 1 deletion chrome/browser/flags/android/chrome_feature_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ extern const base::Feature kSearchEnginePromoNewDeviceV2;
extern const base::Feature kServiceManagerForBackgroundPrefetch;
extern const base::Feature kServiceManagerForDownload;
extern const base::Feature kShareButtonInTopToolbar;
extern const base::Feature kShareCrowButton;
extern const base::Feature kSharingHubLinkToggle;
extern const base::Feature kShowScrollableMVTOnNTPAndroid;
extern const base::Feature kSpannableInlineAutocomplete;
Expand Down
7 changes: 7 additions & 0 deletions components/feed/core/v2/proto_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ feedwire::Request CreateFeedQueryRequest(
feed_request.add_client_capability(Capability::DOWNLOAD_LINK);
}

#if BUILDFLAG(IS_ANDROID)
// Note that the Crow feature is referenced as THANK_CREATOR within the feed.
if (base::FeatureList::IsEnabled(kShareCrowButton)) {
feed_request.add_client_capability(Capability::THANK_CREATOR);
}
#endif

if (base::FeatureList::IsEnabled(kPersonalizeFeedUnsignedUsers)) {
feed_request.add_client_capability(Capability::ON_DEVICE_USER_PROFILE);
}
Expand Down
16 changes: 16 additions & 0 deletions components/feed/core/v2/proto_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,22 @@ TEST(ProtoUtilTest, ReadLaterDisabled) {
Not(Contains((feedwire::Capability::READ_LATER))));
}

#if BUILDFLAG(IS_ANDROID)
TEST(ProtoUtilTest, CrowButtonEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures({kShareCrowButton}, {});
feedwire::FeedRequest request =
CreateFeedQueryRefreshRequest(kForYouStream,
feedwire::FeedQuery::MANUAL_REFRESH,
/*request_metadata=*/{},
/*consistency_token=*/std::string())
.feed_request();

ASSERT_THAT(request.client_capability(),
Contains(feedwire::Capability::THANK_CREATOR));
}
#endif // BUILDFLAG(IS_ANDROID)

TEST(ProtoUtilTest, InfoCardAcknowledgementTrackingEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures({kInfoCardAcknowledgementTracking}, {});
Expand Down
3 changes: 3 additions & 0 deletions components/feed/feed_feature_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const base::Feature kPersonalizeFeedUnsignedUsers{
const base::Feature kInfoCardAcknowledgementTracking{
"InfoCardAcknowledgementTracking", base::FEATURE_DISABLED_BY_DEFAULT};

const base::Feature kShareCrowButton{"ShareCrowButton",
base::FEATURE_DISABLED_BY_DEFAULT};

const base::Feature kIsAblated{"FeedAblation",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace feed
5 changes: 5 additions & 0 deletions components/feed/feed_feature_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ extern const base::Feature kPersonalizeFeedUnsignedUsers;
// Feature that enables tracking the acknowledgement state for the info cards.
extern const base::Feature kInfoCardAcknowledgementTracking;

// Feature that enables the Crow feature.
// Owned by the CwF team but located here until it makes sense to create a crow
// component, since it is being used in the feed component.
extern const base::Feature kShareCrowButton;

// Feature that when enabled completely removes all Feeds from chrome.
extern const base::Feature kIsAblated;

Expand Down

0 comments on commit 471e7eb

Please sign in to comment.