Commit 45b84130 authored by Eugene But's avatar Eugene But Committed by Commit Bot

[ios] Configure Feedback category tag

This will allow to distinguish user feedback sent from Tools Menu vs.
SadTab

Bug: 1138523
Change-Id: Id84c9d548a4f8b607bc6996a644d66fdeb356626
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490392Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819993}
parent f4e41c93
......@@ -45,6 +45,7 @@ source_set("commands") {
]
deps = [
"//ios/public/provider/chrome/browser/user_feedback",
"//ios/web",
"//net",
"//url",
......
......@@ -7,6 +7,8 @@
#import <Foundation/Foundation.h>
#include "ios/public/provider/chrome/browser/user_feedback/user_feedback_sender.h"
@class OpenNewTabCommand;
@class ShowSigninCommand;
@class StartVoiceSearchCommand;
......@@ -113,12 +115,24 @@ enum class KeyRetrievalTriggerForUMA;
// Shows the Report an Issue UI, presenting from |baseViewController|.
- (void)showReportAnIssueFromViewController:
(UIViewController*)baseViewController;
(UIViewController*)baseViewController
sender:(UserFeedbackSender)sender;
// Shows the Report an Issue UI, presenting from |baseViewController|, using
// |specificProductData| for additional product data to be sent in the report
// and UserFeedbackSender::ToolsMenu sender.
// TODO(crbug.com/1138523): Remove this method after Downstream code stop using
// it.
- (void)
showReportAnIssueFromViewController:(UIViewController*)baseViewController
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData;
// Shows the Report an Issue UI, presenting from |baseViewController|, using
// |specificProductData| for additional product data to be sent in the report.
- (void)
showReportAnIssueFromViewController:(UIViewController*)baseViewController
sender:(UserFeedbackSender)sender
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData;
......
......@@ -983,8 +983,10 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
}
- (void)showReportAnIssueFromViewController:
(UIViewController*)baseViewController {
(UIViewController*)baseViewController
sender:(UserFeedbackSender)sender {
[self showReportAnIssueFromViewController:baseViewController
sender:sender
specificProductData:nil];
}
......@@ -992,6 +994,16 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
showReportAnIssueFromViewController:(UIViewController*)baseViewController
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData {
[self showReportAnIssueFromViewController:baseViewController
sender:UserFeedbackSender::ToolsMenu
specificProductData:specificProductData];
}
- (void)
showReportAnIssueFromViewController:(UIViewController*)baseViewController
sender:(UserFeedbackSender)sender
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData {
DCHECK(baseViewController);
self.specificProductData = specificProductData;
// This dispatch is necessary to give enough time for the tools menu to
......@@ -1005,6 +1017,7 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
[SettingsNavigationController userFeedbackControllerForBrowser:browser
delegate:self
feedbackDataSource:self
sender:sender
handler:self];
[baseViewController presentViewController:self.settingsNavigationController
animated:YES
......
......@@ -108,7 +108,8 @@ const char kManagementPageURL[] = "chrome://management";
case PopupMenuActionReportIssue:
RecordAction(UserMetricsAction("MobileMenuReportAnIssue"));
[self.dispatcher
showReportAnIssueFromViewController:self.baseViewController];
showReportAnIssueFromViewController:self.baseViewController
sender:UserFeedbackSender::ToolsMenu];
// Dismisses the popup menu without animation to allow the snapshot to be
// taken without the menu presented.
[self.dispatcher dismissPopupMenuAnimated:NO];
......
......@@ -91,7 +91,8 @@
// TODO(crbug.com/1045047): Use HandlerForProtocol after commands protocol
// clean up.
[static_cast<id<ApplicationCommands>>(self.browser->GetCommandDispatcher())
showReportAnIssueFromViewController:self.baseViewController];
showReportAnIssueFromViewController:self.baseViewController
sender:UserFeedbackSender::SadTab];
}
- (void)sadTabViewController:(SadTabViewController*)sadTabViewController
......
......@@ -217,7 +217,8 @@ TEST_F(SadTabCoordinatorTest, RepeatedFailureAction) {
startDispatchingToTarget:mock_application_commands_handler_
forProtocol:@protocol(ApplicationCommands)];
OCMExpect([mock_application_commands_handler_
showReportAnIssueFromViewController:base_view_controller_]);
showReportAnIssueFromViewController:base_view_controller_
sender:UserFeedbackSender::SadTab]);
[coordinator sadTabTabHelper:nullptr
presentSadTabForWebState:&web_state
......
......@@ -95,6 +95,7 @@ extern NSString* const kSettingsDoneButtonId;
delegate:(id<SettingsNavigationControllerDelegate>)
delegate
feedbackDataSource:(id<UserFeedbackDataSource>)dataSource
sender:(UserFeedbackSender)sender
handler:(id<ApplicationCommands>)handler;
// Creates and displays a new ImportDataTableViewController. |browserState|
......
......@@ -166,6 +166,7 @@ NSString* const kSettingsDoneButtonId = @"kSettingsDoneButtonId";
delegate:(id<SettingsNavigationControllerDelegate>)
delegate
feedbackDataSource:(id<UserFeedbackDataSource>)dataSource
sender:(UserFeedbackSender)sender
handler:(id<ApplicationCommands>)handler {
DCHECK(browser);
DCHECK(ios::GetChromeBrowserProvider()
......@@ -174,7 +175,7 @@ NSString* const kSettingsDoneButtonId = @"kSettingsDoneButtonId";
UIViewController* controller =
ios::GetChromeBrowserProvider()
->GetUserFeedbackProvider()
->CreateViewController(dataSource, handler);
->CreateViewController(dataSource, handler, sender);
DCHECK(controller);
SettingsNavigationController* nc = [[SettingsNavigationController alloc]
initWithRootViewController:controller
......
......@@ -63,12 +63,6 @@ class UserFeedbackProvider {
id<UserFeedbackDataSource> data_source,
id<ApplicationCommands> handler,
UserFeedbackSender sender);
// TODO(crbug.com/1138523): Remove the method below, once
// CreateViewController(id<UserFeedbackDataSource>,
// id<ApplicationCommands>, CategoryTag) is implemented downstream.
virtual UIViewController* CreateViewController(
id<UserFeedbackDataSource> data_source,
id<ApplicationCommands> handler);
// Uploads collected feedback reports.
virtual void Synchronize();
......
......@@ -23,11 +23,4 @@ UIViewController* UserFeedbackProvider::CreateViewController(
return nil;
}
UIViewController* UserFeedbackProvider::CreateViewController(
id<UserFeedbackDataSource> data_source,
id<ApplicationCommands> handler) {
return CreateViewController(data_source, handler,
UserFeedbackSender::ToolsMenu);
}
void UserFeedbackProvider::Synchronize() {}
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