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/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 bool SchemeIsInSchemes(const std::string& scheme, | 56 bool SchemeIsInSchemes(const std::string& scheme, |
57 const std::vector<std::string>& schemes) { | 57 const std::vector<std::string>& schemes) { |
58 return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end(); | 58 return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end(); |
59 } | 59 } |
60 | 60 |
61 // Parse a URL into the components used to resolve its request. |source_name| | 61 // Parse a URL into the components used to resolve its request. |source_name| |
62 // is the hostname and |path| is the remaining portion of the URL. | 62 // is the hostname and |path| is the remaining portion of the URL. |
63 void URLToRequest(const GURL& url, std::string* source_name, | 63 void URLToRequest(const GURL& url, std::string* source_name, |
64 std::string* path) { | 64 std::string* path) { |
| 65 std::vector<std::string> additional_schemes; |
65 DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) || | 66 DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) || |
66 url.SchemeIs(chrome::kChromeUIScheme) || | 67 url.SchemeIs(chrome::kChromeUIScheme) || |
67 SchemeIsInSchemes( | 68 (GetContentClient()->browser()->GetAdditionalWebUISchemes( |
68 url.scheme(), | 69 &additional_schemes), |
69 GetContentClient()->browser()->GetAdditionalWebUISchemes())); | 70 SchemeIsInSchemes(url.scheme(), additional_schemes))); |
70 | 71 |
71 if (!url.is_valid()) { | 72 if (!url.is_valid()) { |
72 NOTREACHED(); | 73 NOTREACHED(); |
73 return; | 74 return; |
74 } | 75 } |
75 | 76 |
76 // Our input looks like: chrome://source_name/extra_bits?foo . | 77 // Our input looks like: chrome://source_name/extra_bits?foo . |
77 // So the url's "host" is our source, and everything after the host is | 78 // So the url's "host" is our source, and everything after the host is |
78 // the path. | 79 // the path. |
79 source_name->assign(url.host()); | 80 source_name->assign(url.host()); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 624 |
624 } // namespace | 625 } // namespace |
625 | 626 |
626 net::URLRequestJobFactory::ProtocolHandler* | 627 net::URLRequestJobFactory::ProtocolHandler* |
627 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 628 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
628 bool is_incognito) { | 629 bool is_incognito) { |
629 return new DevToolsJobFactory(resource_context, is_incognito); | 630 return new DevToolsJobFactory(resource_context, is_incognito); |
630 } | 631 } |
631 | 632 |
632 } // namespace content | 633 } // namespace content |
OLD | NEW |