Commit fbe607bd authored by Ramya Sharma's avatar Ramya Sharma Committed by Commit Bot

Implements move for multiple selection on context menu.

- Move functionality for multiple Folder selection
- Move functionality for multiple URL selection
- Move functionality for multiple Folder / URL selection
- Eg tests for the same.

Bug: 695749
Change-Id: I5c64c6ddc10fb5e47e1fcd521afea9498f653ae4
Reviewed-on: https://chromium-review.googlesource.com/662538
Commit-Queue: Ramya Sharma <ramyasharma@chromium.org>
Reviewed-by: default avatarMarti Wong <martiw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501207}
parent 3c6304c0
...@@ -1145,9 +1145,10 @@ const CGFloat kSpacer = 50; ...@@ -1145,9 +1145,10 @@ const CGFloat kSpacer = 50;
break; break;
case BookmarksContextBarMultipleURLSelection: case BookmarksContextBarMultipleURLSelection:
// More clicked, show action sheet with context menu. // More clicked, show action sheet with context menu.
[self presentViewController:[self contextMenuForMultipleBookmarkURLs] [self
animated:YES presentViewController:[self contextMenuForMultipleBookmarkURLs:nodes]
completion:nil]; animated:YES
completion:nil];
break; break;
case BookmarksContextBarSingleFolderSelection: case BookmarksContextBarSingleFolderSelection:
// Edit clicked, open the editor. // Edit clicked, open the editor.
...@@ -1259,7 +1260,9 @@ const CGFloat kSpacer = 50; ...@@ -1259,7 +1260,9 @@ const CGFloat kSpacer = 50;
#pragma mark - Context Menu #pragma mark - Context Menu
- (UIAlertController*)contextMenuForMultipleBookmarkURLs { - (UIAlertController*)contextMenuForMultipleBookmarkURLs:
(const std::set<const bookmarks::BookmarkNode*>)nodes {
__weak BookmarkHomeViewController* weakSelf = self;
UIAlertController* alert = [UIAlertController UIAlertController* alert = [UIAlertController
alertControllerWithTitle:nil alertControllerWithTitle:nil
message:nil message:nil
...@@ -1285,7 +1288,9 @@ const CGFloat kSpacer = 50; ...@@ -1285,7 +1288,9 @@ const CGFloat kSpacer = 50;
UIAlertAction* moveAction = [UIAlertAction UIAlertAction* moveAction = [UIAlertAction
actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:nil]; handler:^(UIAlertAction* _Nonnull action) {
[weakSelf moveNodes:nodes];
}];
[alert addAction:openAllAction]; [alert addAction:openAllAction];
[alert addAction:openInIncognitoAction]; [alert addAction:openInIncognitoAction];
[alert addAction:moveAction]; [alert addAction:moveAction];
...@@ -1373,7 +1378,8 @@ const CGFloat kSpacer = 50; ...@@ -1373,7 +1378,8 @@ const CGFloat kSpacer = 50;
} }
- (UIAlertController*)contextMenuForMixedAndMultiFolderSelection: - (UIAlertController*)contextMenuForMixedAndMultiFolderSelection:
(const std::set<const bookmarks::BookmarkNode*>&)nodes { (const std::set<const bookmarks::BookmarkNode*>)nodes {
__weak BookmarkHomeViewController* weakSelf = self;
UIAlertController* alert = [UIAlertController UIAlertController* alert = [UIAlertController
alertControllerWithTitle:nil alertControllerWithTitle:nil
message:nil message:nil
...@@ -1388,7 +1394,9 @@ const CGFloat kSpacer = 50; ...@@ -1388,7 +1394,9 @@ const CGFloat kSpacer = 50;
UIAlertAction* moveAction = [UIAlertAction UIAlertAction* moveAction = [UIAlertAction
actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:nil]; handler:^(UIAlertAction* _Nonnull action) {
[weakSelf moveNodes:nodes];
}];
[alert addAction:moveAction]; [alert addAction:moveAction];
[alert addAction:cancelAction]; [alert addAction:cancelAction];
return alert; return alert;
......
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