OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/extensions/manifest_handlers/content_scripts_handler.h" | 5 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (!PermissionsData::CanExecuteScriptEverywhere(extension) && | 165 if (!PermissionsData::CanExecuteScriptEverywhere(extension) && |
166 pattern.scheme() != content::kChromeUIScheme) { | 166 pattern.scheme() != content::kChromeUIScheme) { |
167 // Exclude SCHEME_CHROMEUI unless it's been explicitly requested. | 167 // Exclude SCHEME_CHROMEUI unless it's been explicitly requested. |
168 // If the --extensions-on-chrome-urls flag has not been passed, requesting | 168 // If the --extensions-on-chrome-urls flag has not been passed, requesting |
169 // a chrome:// url will cause a parse failure above, so there's no need to | 169 // a chrome:// url will cause a parse failure above, so there's no need to |
170 // check the flag here. | 170 // check the flag here. |
171 pattern.SetValidSchemes( | 171 pattern.SetValidSchemes( |
172 pattern.valid_schemes() & ~URLPattern::SCHEME_CHROMEUI); | 172 pattern.valid_schemes() & ~URLPattern::SCHEME_CHROMEUI); |
173 } | 173 } |
174 | 174 |
175 if (pattern.MatchesScheme(content::kFileScheme) && | 175 if (pattern.MatchesScheme(url::kFileScheme) && |
176 !PermissionsData::CanExecuteScriptEverywhere(extension)) { | 176 !PermissionsData::CanExecuteScriptEverywhere(extension)) { |
177 extension->set_wants_file_access(true); | 177 extension->set_wants_file_access(true); |
178 if (!(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS)) { | 178 if (!(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS)) { |
179 pattern.SetValidSchemes( | 179 pattern.SetValidSchemes( |
180 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); | 180 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 result->add_url_pattern(pattern); | 184 result->add_url_pattern(pattern); |
185 } | 185 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if (!IsScriptValid(path, css_script.relative_path(), | 471 if (!IsScriptValid(path, css_script.relative_path(), |
472 IDS_EXTENSION_LOAD_CSS_FAILED, error)) | 472 IDS_EXTENSION_LOAD_CSS_FAILED, error)) |
473 return false; | 473 return false; |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 return true; | 477 return true; |
478 } | 478 } |
479 | 479 |
480 } // namespace extensions | 480 } // namespace extensions |
OLD | NEW |