| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/common/user_script.h" | 5 #include "extensions/common/user_script.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const std::string& mime_type) { | 53 const std::string& mime_type) { |
| 54 return EndsWith(url.ExtractFileName(), kFileExtension, false) && | 54 return EndsWith(url.ExtractFileName(), kFileExtension, false) && |
| 55 mime_type != "text/html"; | 55 mime_type != "text/html"; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 int UserScript::ValidUserScriptSchemes(bool canExecuteScriptEverywhere) { | 59 int UserScript::ValidUserScriptSchemes(bool canExecuteScriptEverywhere) { |
| 60 if (canExecuteScriptEverywhere) | 60 if (canExecuteScriptEverywhere) |
| 61 return URLPattern::SCHEME_ALL; | 61 return URLPattern::SCHEME_ALL; |
| 62 int valid_schemes = kValidUserScriptSchemes; | 62 int valid_schemes = kValidUserScriptSchemes; |
| 63 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 63 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 64 switches::kExtensionsOnChromeURLs)) { | 64 switches::kExtensionsOnChromeURLs)) { |
| 65 valid_schemes &= ~URLPattern::SCHEME_CHROMEUI; | 65 valid_schemes &= ~URLPattern::SCHEME_CHROMEUI; |
| 66 } | 66 } |
| 67 return valid_schemes; | 67 return valid_schemes; |
| 68 } | 68 } |
| 69 | 69 |
| 70 UserScript::File::File(const base::FilePath& extension_root, | 70 UserScript::File::File(const base::FilePath& extension_root, |
| 71 const base::FilePath& relative_path, | 71 const base::FilePath& relative_path, |
| 72 const GURL& url) | 72 const GURL& url) |
| 73 : extension_root_(extension_root), | 73 : extension_root_(extension_root), |
| 74 relative_path_(relative_path), | 74 relative_path_(relative_path), |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 | 253 |
| 254 bool operator<(const UserScript& script1, const UserScript& script2) { | 254 bool operator<(const UserScript& script1, const UserScript& script2) { |
| 255 // The only kind of script that should be compared is the kind that has its | 255 // The only kind of script that should be compared is the kind that has its |
| 256 // IDs initialized to a meaningful value. | 256 // IDs initialized to a meaningful value. |
| 257 DCHECK(script1.id() != -1 && script2.id() != -1); | 257 DCHECK(script1.id() != -1 && script2.id() != -1); |
| 258 return script1.id() < script2.id(); | 258 return script1.id() < script2.id(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace extensions | 261 } // namespace extensions |
| OLD | NEW |