Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: components/open_from_clipboard/clipboard_recent_content.cc

Issue 2808413003: Omnibox - Reduce Clipboard URL Suggestions to 1 Hour (Closed)
Patch Set: fix rebase error Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/open_from_clipboard/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/open_from_clipboard/clipboard_recent_content.cc
diff --git a/components/open_from_clipboard/clipboard_recent_content.cc b/components/open_from_clipboard/clipboard_recent_content.cc
index 31963fe326ca77f8feefac8f4af8e1d61b208603..a06be7bf4542daa9aebf4687c7ab0d61dda495f4 100644
--- a/components/open_from_clipboard/clipboard_recent_content.cc
+++ b/components/open_from_clipboard/clipboard_recent_content.cc
@@ -4,6 +4,9 @@
#include "components/open_from_clipboard/clipboard_recent_content.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/time/time.h"
+#include "components/variations/variations_associated_data.h"
#include "url/url_constants.h"
namespace {
@@ -52,5 +55,18 @@ bool ClipboardRecentContent::IsAppropriateSuggestion(const GURL& url) {
// static
base::TimeDelta ClipboardRecentContent::MaximumAgeOfClipboard() {
- return base::TimeDelta::FromHours(3);
+ // Identify the current setting for this parameter from the omnibox field
+ // trial.
+ std::string value_str = variations::GetVariationParamValue(
+ "OmniboxBundledExperimentV1", "ClipboardURLMaximumAge");
+ // If the parameter is not set, use a 1 hour timeout.
+ if (value_str.empty())
+ return base::TimeDelta::FromHours(1);
+ // This is a best-effort conversion; we trust the hand-crafted parameters
+ // downloaded from the server to be perfect. There's no need for handle
+ // errors smartly.
+ int value;
+ // The value in the parameter is stored in seconds.
+ base::StringToInt(value_str, &value);
+ return base::TimeDelta::FromSeconds(value);
}
« no previous file with comments | « components/open_from_clipboard/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698