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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const char kChromeURLXFrameOptionsHeader[] = "X-Frame-Options: DENY"; | 57 const char kChromeURLXFrameOptionsHeader[] = "X-Frame-Options: DENY"; |
58 | 58 |
59 bool SchemeIsInSchemes(const std::string& scheme, | 59 bool SchemeIsInSchemes(const std::string& scheme, |
60 const std::vector<std::string>& schemes) { | 60 const std::vector<std::string>& schemes) { |
61 return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end(); | 61 return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end(); |
62 } | 62 } |
63 | 63 |
64 // Returns whether |url| passes some sanity checks and is a valid GURL. | 64 // Returns whether |url| passes some sanity checks and is a valid GURL. |
65 bool CheckURLIsValid(const GURL& url) { | 65 bool CheckURLIsValid(const GURL& url) { |
66 std::vector<std::string> additional_schemes; | 66 std::vector<std::string> additional_schemes; |
67 DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) || | 67 DCHECK(url.SchemeIs(kChromeDevToolsScheme) || url.SchemeIs(kChromeUIScheme) || |
68 url.SchemeIs(kChromeUIScheme) || | |
69 (GetContentClient()->browser()->GetAdditionalWebUISchemes( | 68 (GetContentClient()->browser()->GetAdditionalWebUISchemes( |
70 &additional_schemes), | 69 &additional_schemes), |
71 SchemeIsInSchemes(url.scheme(), additional_schemes))); | 70 SchemeIsInSchemes(url.scheme(), additional_schemes))); |
72 | 71 |
73 if (!url.is_valid()) { | 72 if (!url.is_valid()) { |
74 NOTREACHED(); | 73 NOTREACHED(); |
75 return false; | 74 return false; |
76 } | 75 } |
77 | 76 |
78 return true; | 77 return true; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 714 |
716 } // namespace | 715 } // namespace |
717 | 716 |
718 net::URLRequestJobFactory::ProtocolHandler* | 717 net::URLRequestJobFactory::ProtocolHandler* |
719 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 718 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
720 bool is_incognito) { | 719 bool is_incognito) { |
721 return new DevToolsJobFactory(resource_context, is_incognito); | 720 return new DevToolsJobFactory(resource_context, is_incognito); |
722 } | 721 } |
723 | 722 |
724 } // namespace content | 723 } // namespace content |
OLD | NEW |