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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « components/open_from_clipboard/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/open_from_clipboard/clipboard_recent_content.h" 5 #include "components/open_from_clipboard/clipboard_recent_content.h"
6 6
7 #include "base/strings/string_number_conversions.h"
8 #include "base/time/time.h"
9 #include "components/variations/variations_associated_data.h"
7 #include "url/url_constants.h" 10 #include "url/url_constants.h"
8 11
9 namespace { 12 namespace {
10 ClipboardRecentContent* g_clipboard_recent_content = nullptr; 13 ClipboardRecentContent* g_clipboard_recent_content = nullptr;
11 14
12 // Schemes appropriate for suggestion by ClipboardRecentContent. 15 // Schemes appropriate for suggestion by ClipboardRecentContent.
13 const char* kAuthorizedSchemes[] = { 16 const char* kAuthorizedSchemes[] = {
14 url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme, 17 url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme,
15 // TODO(mpearson): add support for chrome:// URLs. Right now the scheme 18 // TODO(mpearson): add support for chrome:// URLs. Right now the scheme
16 // for that lives in content and is accessible via 19 // for that lives in content and is accessible via
(...skipping 28 matching lines...) Expand all
45 if (url.SchemeIs(authorized_scheme)) 48 if (url.SchemeIs(authorized_scheme))
46 return true; 49 return true;
47 } 50 }
48 51
49 // Not a scheme we're allowed to return. 52 // Not a scheme we're allowed to return.
50 return false; 53 return false;
51 } 54 }
52 55
53 // static 56 // static
54 base::TimeDelta ClipboardRecentContent::MaximumAgeOfClipboard() { 57 base::TimeDelta ClipboardRecentContent::MaximumAgeOfClipboard() {
55 return base::TimeDelta::FromHours(3); 58 // Identify the current setting for this parameter from the omnibox field
59 // trial.
60 std::string value_str = variations::GetVariationParamValue(
61 "OmniboxBundledExperimentV1", "ClipboardURLMaximumAge");
62 // If the parameter is not set, use a 1 hour timeout.
63 if (value_str.empty())
64 return base::TimeDelta::FromHours(1);
65 // This is a best-effort conversion; we trust the hand-crafted parameters
66 // downloaded from the server to be perfect. There's no need for handle
67 // errors smartly.
68 int value;
69 // The value in the parameter is stored in seconds.
70 base::StringToInt(value_str, &value);
71 return base::TimeDelta::FromSeconds(value);
56 } 72 }
OLDNEW
« 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