Commit 0af1b90b authored by Ewann's avatar Ewann Committed by Commit Bot

[iOS] Fixes context menu style

This CL fixes some style issue related to context menu.

Bug: 1093302
Change-Id: I53966504a431b9545c4d79ebaf6bbbdfdda77d88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2325615
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSebastien Lalancette <seblalancette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792759}
parent 43d515d3
......@@ -2182,14 +2182,14 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
if (node->is_url()) {
actionProvider = ^(NSArray<UIMenuElement*>* suggestedActions) {
// Record that this context menu was shown to the user.
RecordMenuShown(MenuScenario::BookmarkEntry);
RecordMenuShown(MenuScenario::kBookmarkEntry);
ActionFactory* actionFactory =
[[ActionFactory alloc] initWithScenario:MenuScenario::BookmarkEntry];
[[ActionFactory alloc] initWithScenario:MenuScenario::kBookmarkEntry];
UIAction* copyAction = [actionFactory actionToCopyURL:node->url()];
return [UIMenu menuWithTitle:[NSString string] children:@[ copyAction ]];
return [UIMenu menuWithTitle:@"" children:@[ copyAction ]];
};
}
......
......@@ -175,9 +175,9 @@
#pragma mark - HistoryMenuProvider
- (UIContextMenuConfiguration*)createConfigurationForItem:
- (UIContextMenuConfiguration*)contextMenuConfigurationForItem:
(HistoryEntryItem*)item
withView:(UIView*)view
withView:(UIView*)view
API_AVAILABLE(ios(13.0)) {
__weak id<HistoryEntryItemDelegate> historyItemDelegate =
self.historyTableViewController;
......@@ -185,10 +185,10 @@
UIContextMenuActionProvider actionProvider =
^(NSArray<UIMenuElement*>* suggestedActions) {
// Record that this context menu was shown to the user.
RecordMenuShown(MenuScenario::HistoryEntry);
RecordMenuShown(MenuScenario::kHistoryEntry);
ActionFactory* actionFactory =
[[ActionFactory alloc] initWithScenario:MenuScenario::HistoryEntry];
ActionFactory* actionFactory = [[ActionFactory alloc]
initWithScenario:MenuScenario::kHistoryEntry];
UIAction* copyAction = [actionFactory actionToCopyURL:item.URL];
......@@ -196,7 +196,7 @@
[historyItemDelegate historyEntryItemDidRequestDelete:item];
}];
return [UIMenu menuWithTitle:[NSString string]
return [UIMenu menuWithTitle:@""
children:@[ copyAction, deleteAction ]];
};
......
......@@ -7,14 +7,14 @@
#import "ios/chrome/browser/ui/history/history_entry_item.h"
// Protocol for instances that will provide menus to history components.
// Protocol for instances that will provide menus to History components.
@protocol HistoryMenuProvider
// Creates a context menu configuration instance for the given |item|, which is
// represented on the UI by |view|.
- (UIContextMenuConfiguration*)createConfigurationForItem:
- (UIContextMenuConfiguration*)contextMenuConfigurationForItem:
(HistoryEntryItem*)item
withView:(UIView*)view
withView:(UIView*)view
API_AVAILABLE(ios(13.0));
@end
......
......@@ -628,7 +628,8 @@ const CGFloat kButtonHorizontalPadding = 30.0;
HistoryEntryItem* entry = base::mac::ObjCCastStrict<HistoryEntryItem>(
[self.tableViewModel itemAtIndexPath:indexPath]);
UIView* cell = [self.tableView cellForRowAtIndexPath:indexPath];
return [self.menuProvider createConfigurationForItem:entry withView:cell];
return [self.menuProvider contextMenuConfigurationForItem:entry
withView:cell];
}
#pragma mark - UITableViewDataSource
......
......@@ -27,7 +27,7 @@
#if defined(__IPHONE_13_0)
namespace {
MenuScenario kTestMenuScenario = MenuScenario::HistoryEntry;
MenuScenario kTestMenuScenario = MenuScenario::kHistoryEntry;
} // namespace
// Test fixture for the ActionFactory.
......
......@@ -9,9 +9,9 @@
// not be renumbered. Please keep in sync with "IOSMenuScenario" in
// src/tools/metrics/histograms/enums.xml.
enum class MenuScenario {
HistoryEntry = 0,
BookmarkEntry = 1,
kMaxValue = BookmarkEntry
kHistoryEntry = 0,
kBookmarkEntry = 1,
kMaxValue = kBookmarkEntry
};
// Records a menu shown histogram metric for the |scenario|.
......
......@@ -27,9 +27,9 @@ void RecordMenuShown(MenuScenario scenario) {
const char* GetActionsHistogramName(MenuScenario scenario) {
switch (scenario) {
case MenuScenario::HistoryEntry:
case MenuScenario::kHistoryEntry:
return kHistoryEntryActionsHistogram;
case MenuScenario::BookmarkEntry:
case MenuScenario::kBookmarkEntry:
return kBookmarkEntryActionsHistogram;
}
}
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