Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/browser_url_handler_impl.h" | 5 #include "content/browser/browser_url_handler_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "content/browser/frame_host/debug_urls.h" | 9 #include "content/browser/frame_host/debug_urls.h" |
| 10 #include "content/browser/webui/web_ui_impl.h" | 10 #include "content/browser/webui/web_ui_impl.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 bool is_sub_scheme_allowed = false; | 32 bool is_sub_scheme_allowed = false; |
| 33 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) { | 33 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) { |
| 34 if (url->SchemeIs(allowed_sub_schemes[i])) { | 34 if (url->SchemeIs(allowed_sub_schemes[i])) { |
| 35 is_sub_scheme_allowed = true; | 35 is_sub_scheme_allowed = true; |
| 36 break; | 36 break; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 // If none of the default allowed schemes match, try with additional schemes | |
| 41 // from the ContentClient. | |
| 42 if (!is_sub_scheme_allowed) { | |
| 43 std::vector<std::string> additional_schemes; | |
| 44 GetContentClient()->browser()->GetAdditionalSchemesForViewSource( | |
|
jam
2014/01/24 22:07:55
actually, now that I think about it some more, it
nyquist
2014/01/25 00:40:38
Done.
One note: this adds chrome::kChromeSearchSc
| |
| 45 &additional_schemes); | |
| 46 for (size_t i = 0; i < additional_schemes.size(); ++i) { | |
| 47 if (url->SchemeIs(additional_schemes[i].c_str())) { | |
| 48 is_sub_scheme_allowed = true; | |
| 49 break; | |
| 50 } | |
| 51 } | |
| 52 } | |
| 53 | |
| 40 if (!is_sub_scheme_allowed) { | 54 if (!is_sub_scheme_allowed) { |
| 41 *url = GURL(kAboutBlankURL); | 55 *url = GURL(kAboutBlankURL); |
| 42 return false; | 56 return false; |
| 43 } | 57 } |
| 44 | 58 |
| 45 return true; | 59 return true; |
| 46 } | 60 } |
| 47 return false; | 61 return false; |
| 48 } | 62 } |
| 49 | 63 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return true; | 153 return true; |
| 140 } else if (handler(&test_url, browser_context)) { | 154 } else if (handler(&test_url, browser_context)) { |
| 141 return reverse_rewriter(url, browser_context); | 155 return reverse_rewriter(url, browser_context); |
| 142 } | 156 } |
| 143 } | 157 } |
| 144 } | 158 } |
| 145 return false; | 159 return false; |
| 146 } | 160 } |
| 147 | 161 |
| 148 } // namespace content | 162 } // namespace content |
| OLD | NEW |