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

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

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const char UserScript::kFileExtension[] = ".user.js"; 44 const char UserScript::kFileExtension[] = ".user.js";
45 45
46 46
47 // static 47 // static
48 int UserScript::GenerateUserScriptID() { 48 int UserScript::GenerateUserScriptID() {
49 return g_user_script_id_generator.GetNext(); 49 return g_user_script_id_generator.GetNext();
50 } 50 }
51 51
52 bool UserScript::IsURLUserScript(const GURL& url, 52 bool UserScript::IsURLUserScript(const GURL& url,
53 const std::string& mime_type) { 53 const std::string& mime_type) {
54 return EndsWith(url.ExtractFileName(), kFileExtension, false) && 54 return base::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 (!base::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;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 281
282 bool operator<(const UserScript& script1, const UserScript& script2) { 282 bool operator<(const UserScript& script1, const UserScript& script2) {
283 // The only kind of script that should be compared is the kind that has its 283 // The only kind of script that should be compared is the kind that has its
284 // IDs initialized to a meaningful value. 284 // IDs initialized to a meaningful value.
285 DCHECK(script1.id() != -1 && script2.id() != -1); 285 DCHECK(script1.id() != -1 && script2.id() != -1);
286 return script1.id() < script2.id(); 286 return script1.id() < script2.id();
287 } 287 }
288 288
289 } // namespace extensions 289 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/web_request/web_request_permissions.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698