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

Side by Side Diff: chrome/browser/history/url_utils.cc

Issue 722723005: Move constants used by history component to history namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patchset Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/history/url_utils.h" 5 #include "chrome/browser/history/url_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/common/url_constants.h"
10 #include "components/dom_distiller/core/url_constants.h"
9 #include "url/gurl.h" 11 #include "url/gurl.h"
10 12
11 namespace history { 13 namespace history {
12 14
13 namespace { 15 namespace {
14 16
15 // Comparator to enforce '\0' < '?' < '#' < '/' < other characters. 17 // Comparator to enforce '\0' < '?' < '#' < '/' < other characters.
16 int GetURLCharPriority(char ch) { 18 int GetURLCharPriority(char ch) {
17 switch (ch) { 19 switch (ch) {
18 case '\0': return 0; 20 case '\0': return 0;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 new_scheme = "http"; 80 new_scheme = "http";
79 else 81 else
80 return GURL::EmptyGURL(); 82 return GURL::EmptyGURL();
81 url::Component comp; 83 url::Component comp;
82 comp.len = new_scheme.length(); 84 comp.len = new_scheme.length();
83 GURL::Replacements replacement; 85 GURL::Replacements replacement;
84 replacement.SetScheme(new_scheme.c_str(), comp); 86 replacement.SetScheme(new_scheme.c_str(), comp);
85 return url.ReplaceComponents(replacement); 87 return url.ReplaceComponents(replacement);
86 } 88 }
87 89
90 bool CanAddURL(const GURL& url) {
sdefresne 2014/11/21 14:11:41 We won't be able to move this function into the co
nshaik 2014/11/25 22:21:14 Will do it in the other CL.
91 if (!url.is_valid())
92 return false;
93
94 // TODO: We should allow kChromeUIScheme URLs if they have been explicitly
95 // typed. Right now, however, these are marked as typed even when triggered
96 // by a shortcut or menu action.
97 if (url.SchemeIs(url::kJavaScriptScheme) ||
98 url.SchemeIs(content::kChromeDevToolsScheme) ||
99 url.SchemeIs(content::kChromeUIScheme) ||
100 url.SchemeIs(content::kViewSourceScheme) ||
101 url.SchemeIs(chrome::kChromeNativeScheme) ||
102 url.SchemeIs(chrome::kChromeSearchScheme) ||
103 url.SchemeIs(dom_distiller::kDomDistillerScheme))
104 return false;
105
106 // Allow all about: and chrome: URLs except about:blank, since the user may
107 // like to see "chrome://memory/", etc. in their history and autocomplete.
108 if (url == GURL(url::kAboutBlankURL))
109 return false;
110
111 return true;
112 }
113
88 } // namespace history 114 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/url_utils.h ('k') | chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698