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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 url.SchemeIs(chrome::kChromeUIScheme) || | 69 url.SchemeIs(chrome::kChromeUIScheme) || |
70 (GetContentClient()->browser()->GetAdditionalWebUISchemes( | 70 (GetContentClient()->browser()->GetAdditionalWebUISchemes( |
71 &additional_schemes), | 71 &additional_schemes), |
72 SchemeIsInSchemes(url.scheme(), additional_schemes))); | 72 SchemeIsInSchemes(url.scheme(), additional_schemes))); |
73 | 73 |
74 if (!url.is_valid()) { | 74 if (!url.is_valid()) { |
75 NOTREACHED(); | 75 NOTREACHED(); |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 // Our input looks like: chrome://source_name/extra_bits?foo . | 79 if (url.SchemeIs(chrome::kDomDistillerScheme)) { |
80 // So the url's "host" is our source, and everything after the host is | 80 // Our input looks like: chrome-distiller://some-entry , so the scheme of |
81 // the path. | 81 // the URL is the source name. |
82 source_name->assign(url.host()); | 82 source_name->assign(chrome::kDomDistillerScheme); |
| 83 } else { |
| 84 // Our input looks like: chrome://source_name/extra_bits?foo . |
| 85 // So the url's "host" is our source, and everything after the host is |
| 86 // the path. |
| 87 source_name->assign(url.host()); |
| 88 } |
83 | 89 |
84 const std::string& spec = url.possibly_invalid_spec(); | 90 const std::string& spec = url.possibly_invalid_spec(); |
85 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); | 91 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); |
86 // + 1 to skip the slash at the beginning of the path. | 92 // + 1 to skip the slash at the beginning of the path. |
87 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false) + 1; | 93 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false) + 1; |
88 | 94 |
89 if (offset < static_cast<int>(spec.size())) | 95 if (offset < static_cast<int>(spec.size())) |
90 path->assign(spec.substr(offset)); | 96 path->assign(spec.substr(offset)); |
91 } | 97 } |
92 | 98 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 670 |
665 } // namespace | 671 } // namespace |
666 | 672 |
667 net::URLRequestJobFactory::ProtocolHandler* | 673 net::URLRequestJobFactory::ProtocolHandler* |
668 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 674 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
669 bool is_incognito) { | 675 bool is_incognito) { |
670 return new DevToolsJobFactory(resource_context, is_incognito); | 676 return new DevToolsJobFactory(resource_context, is_incognito); |
671 } | 677 } |
672 | 678 |
673 } // namespace content | 679 } // namespace content |
OLD | NEW |