Enable CopiedContentBehavior and omnibox text and image provider flags

Overall, the impact ranges from minimal to positive across the three
flags.

Bug: 933385
Change-Id: Ie6015388b7a1fbd2e71c7a9a6a0b03efde8c957b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660859
Reviewed-by: Justin Donnelly <[email protected]>
Reviewed-by: Cait Phillips <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Commit-Queue: Robbie Gibson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#679422}
diff --git a/components/omnibox/browser/clipboard_provider.cc b/components/omnibox/browser/clipboard_provider.cc
index 97fadbf..fe54f6a 100644
--- a/components/omnibox/browser/clipboard_provider.cc
+++ b/components/omnibox/browser/clipboard_provider.cc
@@ -231,6 +231,12 @@
     return false;
   }
 
+  base::Optional<gfx::Image> optional_image =
+      clipboard_content_->GetRecentImageFromClipboard();
+  if (!optional_image) {
+    return false;
+  }
+
   // Make sure current provider supports image search
   TemplateURLService* url_service = client_->GetTemplateURLService();
   const TemplateURL* default_url = url_service->GetDefaultSearchProvider();
@@ -240,12 +246,6 @@
     return false;
   }
 
-  base::Optional<gfx::Image> optional_image =
-      clipboard_content_->GetRecentImageFromClipboard();
-  if (!optional_image) {
-    return false;
-  }
-
   // We want to get the age here because the contents of the clipboard could
   // change after this point. We want the age of the image we actually use, not
   // the age of whatever's on the clipboard when the histogram is created (i.e
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc
index 882e47eb..89719d4 100644
--- a/components/omnibox/common/omnibox_features.cc
+++ b/components/omnibox/common/omnibox_features.cc
@@ -159,13 +159,23 @@
 
 // Feature to enable clipboard provider to suggest copied text.
 const base::Feature kEnableClipboardProviderTextSuggestions{
-    "OmniboxEnableClipboardProviderTextSuggestions",
-    base::FEATURE_DISABLED_BY_DEFAULT};
+  "OmniboxEnableClipboardProviderTextSuggestions",
+#if defined(OS_IOS)
+      base::FEATURE_ENABLED_BY_DEFAULT
+#else
+      base::FEATURE_DISABLED_BY_DEFAULT
+#endif
+};
 
 // Feature to enable clipboard provider to suggest searching for copied images.
 const base::Feature kEnableClipboardProviderImageSuggestions{
-    "OmniboxEnableClipboardProviderImageSuggestions",
-    base::FEATURE_DISABLED_BY_DEFAULT};
+  "OmniboxEnableClipboardProviderImageSuggestions",
+#if defined(OS_IOS)
+      base::FEATURE_ENABLED_BY_DEFAULT
+#else
+      base::FEATURE_DISABLED_BY_DEFAULT
+#endif
+};
 
 // Feature to enable the search provider to send a request to the suggest
 // server on focus.  This allows the suggest server to warm up, by, for
diff --git a/components/open_from_clipboard/clipboard_recent_content.cc b/components/open_from_clipboard/clipboard_recent_content.cc
index 11cb69c6..620f75be9 100644
--- a/components/open_from_clipboard/clipboard_recent_content.cc
+++ b/components/open_from_clipboard/clipboard_recent_content.cc
@@ -6,6 +6,7 @@
 
 #include "base/strings/string_number_conversions.h"
 #include "base/time/time.h"
+#include "build/build_config.h"
 #include "components/open_from_clipboard/clipboard_recent_content_features.h"
 #include "components/variations/variations_associated_data.h"
 #include "url/url_constants.h"
@@ -36,7 +37,13 @@
 base::TimeDelta ClipboardRecentContent::MaximumAgeOfClipboard() {
   // Identify the current setting for this parameter from the feature, using
   // 3600 seconds (1 hour) as a default if the parameter is not set.
+  // On iOS, the default is 600 seconds (10 minutes).
+#if defined(OS_IOS)
+  int default_maximum_age = 600;
+#else
+  int default_maximum_age = 3600;
+#endif
   int value = variations::GetVariationParamByFeatureAsInt(
-      kClipboardMaximumAge, kClipboardMaximumAgeParam, 3600);
+      kClipboardMaximumAge, kClipboardMaximumAgeParam, default_maximum_age);
   return base::TimeDelta::FromSeconds(value);
 }