OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_protocols.h" | 5 #include "chrome/browser/extensions/extension_protocols.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (!info) { | 79 if (!info) { |
80 LOG(ERROR) << "Allowing load of " << request->url().spec() | 80 LOG(ERROR) << "Allowing load of " << request->url().spec() |
81 << "from unknown origin. Could not find user data for " | 81 << "from unknown origin. Could not find user data for " |
82 << "request."; | 82 << "request."; |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 // Don't allow toplevel navigations to extension resources in incognito mode. | 86 // Don't allow toplevel navigations to extension resources in incognito mode. |
87 // This is because an extension must run in a single process, and an | 87 // This is because an extension must run in a single process, and an |
88 // incognito tab prevents that. | 88 // incognito tab prevents that. |
89 if (context->is_off_the_record() && | 89 if (context->is_incognito() && |
90 info->resource_type() == ResourceType::MAIN_FRAME && | 90 info->resource_type() == ResourceType::MAIN_FRAME && |
91 !context->extension_info_map()-> | 91 !context->extension_info_map()-> |
92 ExtensionCanLoadInIncognito(request->url().host())) { | 92 ExtensionCanLoadInIncognito(request->url().host())) { |
93 LOG(ERROR) << "Denying load of " << request->url().spec() << " from " | 93 LOG(ERROR) << "Denying load of " << request->url().spec() << " from " |
94 << "incognito tab."; | 94 << "incognito tab."; |
95 return false; | 95 return false; |
96 } | 96 } |
97 | 97 |
98 return true; | 98 return true; |
99 } | 99 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 return new net::URLRequestFileJob(request, resource.GetFilePath()); | 179 return new net::URLRequestFileJob(request, resource.GetFilePath()); |
180 } | 180 } |
181 | 181 |
182 void RegisterExtensionProtocols() { | 182 void RegisterExtensionProtocols() { |
183 net::URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme, | 183 net::URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme, |
184 &CreateExtensionURLRequestJob); | 184 &CreateExtensionURLRequestJob); |
185 net::URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme, | 185 net::URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme, |
186 &CreateUserScriptURLRequestJob); | 186 &CreateUserScriptURLRequestJob); |
187 } | 187 } |
OLD | NEW |