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

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

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/update_manifest.cc ('k') | chrome/common/unix_domain_socket_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/user_script.h" 5 #include "chrome/common/extensions/user_script.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 9
10 namespace { 10 namespace {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 UserScript::~UserScript() { 72 UserScript::~UserScript() {
73 } 73 }
74 74
75 void UserScript::add_url_pattern(const URLPattern& pattern) { 75 void UserScript::add_url_pattern(const URLPattern& pattern) {
76 url_patterns_.push_back(pattern); 76 url_patterns_.push_back(pattern);
77 } 77 }
78 78
79 void UserScript::clear_url_patterns() { url_patterns_.clear(); } 79 void UserScript::clear_url_patterns() { url_patterns_.clear(); }
80 80
81 bool UserScript::MatchesUrl(const GURL& url) const { 81 bool UserScript::MatchesUrl(const GURL& url) const {
82 if (url_patterns_.size() > 0) { 82 if (!url_patterns_.empty()) {
83 if (!UrlMatchesPatterns(&url_patterns_, url)) 83 if (!UrlMatchesPatterns(&url_patterns_, url))
84 return false; 84 return false;
85 } 85 }
86 86
87 if (globs_.size() > 0) { 87 if (!globs_.empty()) {
88 if (!UrlMatchesGlobs(&globs_, url)) 88 if (!UrlMatchesGlobs(&globs_, url))
89 return false; 89 return false;
90 } 90 }
91 91
92 if (exclude_globs_.size() > 0) { 92 if (!exclude_globs_.empty()) {
93 if (UrlMatchesGlobs(&exclude_globs_, url)) 93 if (UrlMatchesGlobs(&exclude_globs_, url))
94 return false; 94 return false;
95 } 95 }
96 96
97 return true; 97 return true;
98 } 98 }
99 99
100 void UserScript::File::Pickle(::Pickle* pickle) const { 100 void UserScript::File::Pickle(::Pickle* pickle) const {
101 pickle->WriteString(url_.spec()); 101 pickle->WriteString(url_.spec());
102 // Do not write path. It's not needed in the renderer. 102 // Do not write path. It's not needed in the renderer.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Read css scripts. 212 // Read css scripts.
213 size_t num_css_files = 0; 213 size_t num_css_files = 0;
214 CHECK(pickle.ReadSize(iter, &num_css_files)); 214 CHECK(pickle.ReadSize(iter, &num_css_files));
215 css_scripts_.clear(); 215 css_scripts_.clear();
216 for (size_t i = 0; i < num_css_files; ++i) { 216 for (size_t i = 0; i < num_css_files; ++i) {
217 File file; 217 File file;
218 file.Unpickle(pickle, iter); 218 file.Unpickle(pickle, iter);
219 css_scripts_.push_back(file); 219 css_scripts_.push_back(file);
220 } 220 }
221 } 221 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/update_manifest.cc ('k') | chrome/common/unix_domain_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698