| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "extensions/common/switches.h" | 10 #include "extensions/common/switches.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 | 28 |
| 29 // The bitmask for valid user script injectable schemes used by URLPattern. | 29 // The bitmask for valid user script injectable schemes used by URLPattern. |
| 30 enum { | 30 enum { |
| 31 kValidUserScriptSchemes = URLPattern::SCHEME_CHROMEUI | | 31 kValidUserScriptSchemes = URLPattern::SCHEME_CHROMEUI | |
| 32 URLPattern::SCHEME_HTTP | | 32 URLPattern::SCHEME_HTTP | |
| 33 URLPattern::SCHEME_HTTPS | | 33 URLPattern::SCHEME_HTTPS | |
| 34 URLPattern::SCHEME_FILE | | 34 URLPattern::SCHEME_FILE | |
| 35 URLPattern::SCHEME_FTP | 35 URLPattern::SCHEME_FTP | |
| 36 URLPattern::SCHEME_ABOUT |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 // static | 39 // static |
| 39 const char UserScript::kFileExtension[] = ".user.js"; | 40 const char UserScript::kFileExtension[] = ".user.js"; |
| 40 | 41 |
| 41 bool UserScript::IsURLUserScript(const GURL& url, | 42 bool UserScript::IsURLUserScript(const GURL& url, |
| 42 const std::string& mime_type) { | 43 const std::string& mime_type) { |
| 43 return EndsWith(url.ExtractFileName(), kFileExtension, false) && | 44 return EndsWith(url.ExtractFileName(), kFileExtension, false) && |
| 44 mime_type != "text/html"; | 45 mime_type != "text/html"; |
| 45 } | 46 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 CHECK(pickle.ReadUInt64(iter, &num_files)); | 228 CHECK(pickle.ReadUInt64(iter, &num_files)); |
| 228 scripts->clear(); | 229 scripts->clear(); |
| 229 for (uint64 i = 0; i < num_files; ++i) { | 230 for (uint64 i = 0; i < num_files; ++i) { |
| 230 File file; | 231 File file; |
| 231 file.Unpickle(pickle, iter); | 232 file.Unpickle(pickle, iter); |
| 232 scripts->push_back(file); | 233 scripts->push_back(file); |
| 233 } | 234 } |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace extensions | 237 } // namespace extensions |
| OLD | NEW |