[Omnibox] Remove unnecessary callback

During developing, I found that NewClipboardImageMatch do not make
another call to get the image since it already has it.

Change-Id: I21657ff64d166f5905518b67e3c4815e1cdde8f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2803923
Reviewed-by: Justin Donnelly <[email protected]>
Reviewed-by: Robbie Gibson <[email protected]>
Commit-Queue: Gang Wu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#869590}
diff --git a/components/omnibox/browser/clipboard_provider.cc b/components/omnibox/browser/clipboard_provider.cc
index 73de409..152adb0e 100644
--- a/components/omnibox/browser/clipboard_provider.cc
+++ b/components/omnibox/browser/clipboard_provider.cc
@@ -409,15 +409,12 @@
     const AutocompleteInput& input,
     const base::TimeDelta clipboard_contents_age,
     base::Optional<gfx::Image> optional_image) {
-  if (!optional_image) {
-    return;
-  }
   NewClipboardImageMatch(
-      optional_image.value(),
-      base::BindOnce(&ClipboardProvider::AddImageMatchCallback,
-                     callback_weak_ptr_factory_.GetWeakPtr(), input,
-                     clipboard_contents_age));
+      optional_image, base::BindOnce(&ClipboardProvider::AddImageMatchCallback,
+                                     callback_weak_ptr_factory_.GetWeakPtr(),
+                                     input, clipboard_contents_age));
 }
+
 void ClipboardProvider::AddImageMatchCallback(
     const AutocompleteInput& input,
     const base::TimeDelta clipboard_contents_age,
@@ -526,16 +523,8 @@
 }
 
 void ClipboardProvider::NewClipboardImageMatch(
-    gfx::Image image,
+    base::Optional<gfx::Image> optional_image,
     ClipboardImageMatchCallback callback) {
-  clipboard_content_->GetRecentImageFromClipboard(base::BindOnce(
-      &ClipboardProvider::OnReceiveImage,
-      callback_weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
-}
-
-void ClipboardProvider::OnReceiveImage(
-    ClipboardImageMatchCallback callback,
-    base::Optional<gfx::Image> optional_image) {
   // ImageSkia::ToImageSkia should only be called if the gfx::Image is
   // non-empty. It is unclear when the clipboard returns a non-optional but
   // empty image. See crbug.com/1136759 for more details.