OLD | NEW |
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 "ios/chrome/browser/history/history_utils.h" | 5 #include "ios/chrome/browser/history/history_utils.h" |
6 | 6 |
7 #include "components/dom_distiller/core/url_constants.h" | 7 #include "components/dom_distiller/core/url_constants.h" |
8 #include "ios/chrome/browser/chrome_url_constants.h" | 8 #include "ios/chrome/browser/chrome_url_constants.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 #include "url/url_constants.h" | 10 #include "url/url_constants.h" |
11 | 11 |
12 namespace ios { | 12 namespace ios { |
13 | 13 |
14 // Returns true if this looks like the type of URL that should be added to the | 14 // Returns true if this looks like the type of URL that should be added to the |
15 // history. This filters out URLs such a JavaScript. | 15 // history. This filters out URLs such a JavaScript. |
16 bool CanAddURLToHistory(const GURL& url) { | 16 bool CanAddURLToHistory(const GURL& url) { |
17 if (!url.is_valid()) | 17 if (!url.is_valid()) |
18 return false; | 18 return false; |
19 | 19 |
20 // TODO: We should allow ChromeUIScheme URLs if they have been explicitly | 20 // TODO: We should allow ChromeUIScheme URLs if they have been explicitly |
21 // typed. Right now, however, these are marked as typed even when triggered | 21 // typed. Right now, however, these are marked as typed even when triggered |
22 // by a shortcut or menu action. | 22 // by a shortcut or menu action. |
23 if (url.SchemeIs(url::kJavaScriptScheme) || | 23 if (url.SchemeIs(url::kJavaScriptScheme) || |
24 url.SchemeIs(dom_distiller::kDomDistillerScheme) || | 24 url.SchemeIs(dom_distiller::kDomDistillerScheme) || |
25 url.SchemeIs(kChromeUIScheme)) | 25 url.SchemeIs(kChromeUIScheme)) |
26 return false; | 26 return false; |
27 | 27 |
28 // Allow all about: and chrome: URLs except about:blank, since the user may | 28 // Allow all about: and chrome: URLs except about:blank, since the user may |
29 // like to see "chrome://memory/", etc. in their history and autocomplete. | 29 // like to see "chrome://version", etc. in their history and autocomplete. |
30 if (url == GURL(url::kAboutBlankURL)) | 30 if (url == GURL(url::kAboutBlankURL)) |
31 return false; | 31 return false; |
32 | 32 |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 } // namespace ios | 36 } // namespace ios |
OLD | NEW |