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( | |
45 &additional_schemes); | |
46 for (std::vector<std::string>::const_iterator it = | |
bengr
2014/01/24 17:10:40
for (size_t i = 0; i < additional_schemes.size();
| |
47 additional_schemes.begin(); | |
48 it != additional_schemes.end(); | |
49 ++it) { | |
50 std::string scheme = *it; | |
51 if (url->SchemeIs(scheme.c_str())) { | |
52 is_sub_scheme_allowed = true; | |
53 break; | |
54 } | |
55 } | |
56 } | |
57 | |
40 if (!is_sub_scheme_allowed) { | 58 if (!is_sub_scheme_allowed) { |
41 *url = GURL(kAboutBlankURL); | 59 *url = GURL(kAboutBlankURL); |
42 return false; | 60 return false; |
43 } | 61 } |
44 | 62 |
45 return true; | 63 return true; |
46 } | 64 } |
47 return false; | 65 return false; |
48 } | 66 } |
49 | 67 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 return true; | 157 return true; |
140 } else if (handler(&test_url, browser_context)) { | 158 } else if (handler(&test_url, browser_context)) { |
141 return reverse_rewriter(url, browser_context); | 159 return reverse_rewriter(url, browser_context); |
142 } | 160 } |
143 } | 161 } |
144 } | 162 } |
145 return false; | 163 return false; |
146 } | 164 } |
147 | 165 |
148 } // namespace content | 166 } // namespace content |
OLD | NEW |