Commit d4a9f377 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

Add feedback button for Kaleidoscope

This will open a feedback dialog when clicked.

BUG=1111981

Change-Id: I8a7091181231ffb405f0369aa67e423b191bcdf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333371Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794723}
parent 38a481be
......@@ -10,8 +10,10 @@
#include "base/strings/string_util.h"
#include "chrome/browser/media/history/media_history_keyed_service.h"
#include "chrome/browser/media/history/media_history_keyed_service_factory.h"
#include "chrome/browser/media/kaleidoscope/constants.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/channel_info.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
......@@ -43,6 +45,10 @@ constexpr char kChromeMediaRecommendationsOAuth2Scope[] =
constexpr base::TimeDelta kProviderHighWatchTimeMin =
base::TimeDelta::FromMinutes(30);
// The feedback tag for Kaleidoscope.
constexpr char kKaleidoscopeFeedbackCategoryTag[] =
"kaleidoscope_settings_menu";
base::Optional<media_feeds::mojom::MediaFeedItemType> GetFeedItemTypeForTab(
media::mojom::KaleidoscopeTab tab) {
switch (tab) {
......@@ -153,6 +159,15 @@ void KaleidoscopeDataProviderImpl::GetContinueWatchingMediaFeedItems(
weak_ptr_factory.GetWeakPtr(), std::move(callback)));
}
void KaleidoscopeDataProviderImpl::SendFeedback() {
chrome::ShowFeedbackPage(GURL(kKaleidoscopeUIURL), profile_,
chrome::kFeedbackSourceKaleidoscope,
std::string() /* description_template */,
std::string() /* description_placeholder_text */,
kKaleidoscopeFeedbackCategoryTag /* category_tag */,
std::string() /* extra_diagnostics */);
}
media_history::MediaHistoryKeyedService*
KaleidoscopeDataProviderImpl::GetMediaHistoryService() {
return media_history::MediaHistoryKeyedServiceFactory::GetForProfile(
......
......@@ -48,6 +48,7 @@ class KaleidoscopeDataProviderImpl
GetContinueWatchingMediaFeedItemsCallback callback) override;
void GetCredentials(GetCredentialsCallback cb) override;
void GetHighWatchTimeOrigins(GetHighWatchTimeOriginsCallback cb) override;
void SendFeedback() override;
private:
media_history::MediaHistoryKeyedService* GetMediaHistoryService();
......
......@@ -48,4 +48,8 @@ interface KaleidoscopeDataProvider {
// Returns all the watch time origins from media history store that have
// watch time above a threshold.
GetHighWatchTimeOrigins() => (array<url.mojom.Origin> origins);
// Called when the user clicks the "Send Feedback" button in Kaleidoscope.
// Will trigger a feedback dialog to be displayed.
SendFeedback();
};
......@@ -62,6 +62,7 @@ enum FeedbackSource {
kFeedbackSourceDesktopTabGroups,
kFeedbackSourceMediaApp,
kFeedbackSourceHelpApp,
kFeedbackSourceKaleidoscope,
// Must be last.
kFeedbackSourceCount,
......
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