Commit b35d7616 authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros: Deactivate ImageModelFactory at paste

Move the deactivation of ClipboardImageModelFactory closer
to the paste. This ensures all paths to a paste deactivate the factory.

Bug: 1148077
Change-Id: I8afdc90a3d4d0f6d4a47f7b8f57457d47e96ff59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2548212
Auto-Submit: Alex Newcomer <newcomer@chromium.org>
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarAndrew Xu <andrewxu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829297}
parent 6eca52e4
......@@ -281,9 +281,6 @@ void ClipboardHistoryControllerImpl::OnClipboardHistoryCleared() {
void ClipboardHistoryControllerImpl::ExecuteSelectedMenuItem(int event_flags) {
DCHECK(IsMenuShowing());
// Deactivate ClipboardImageModelFactory prior to pasting to ensure that any
// modifications to the clipboard for HTML rendering purposes are reversed.
ClipboardImageModelFactory::Get()->Deactivate();
auto command = context_menu_->GetSelectedMenuItemCommand();
......@@ -322,6 +319,11 @@ void ClipboardHistoryControllerImpl::PasteMenuItemData(int command_id,
UMA_HISTOGRAM_ENUMERATION(
"Ash.ClipboardHistory.ContextMenu.MenuOptionSelected", command_id,
ClipboardHistoryUtil::kMaxCommandId);
// Deactivate ClipboardImageModelFactory prior to pasting to ensure that any
// modifications to the clipboard for HTML rendering purposes are reversed.
ClipboardImageModelFactory::Get()->Deactivate();
// Force close the context menu. Failure to do so before dispatching our
// synthetic key event will result in the context menu consuming the event.
DCHECK(context_menu_);
......
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