| 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 a31a9d6f76aca9e1c9d9246573a3d54aecedde26..7442e842cfb3ca4d2b1d24e1a9b625d7573de0f6 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 {
|
| @@ -48,3 +51,21 @@ bool ClipboardRecentContent::IsAppropriateSuggestion(const GURL& url) {
|
| // Not a scheme we're allowed to return.
|
| return false;
|
| }
|
| +
|
| +// static
|
| +base::TimeDelta ClipboardRecentContent::MaximumAgeOfClipboard() {
|
| + // 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);
|
| +}
|
|
|