Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: extensions/common/user_script.cc

Issue 226663003: Allow content script insertion on about:-URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove permission warning for about:-scheme Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« extensions/common/url_pattern.cc ('K') | « extensions/common/url_pattern_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698