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

Side by Side Diff: chrome/browser/extensions/extension_file_util.cc

Issue 267051: Minimize dependency of user scripts.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/extensions/extension_file_util.h" 5 #include "chrome/browser/extensions/extension_file_util.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 // Themes cannot contain other extension types. 178 // Themes cannot contain other extension types.
179 return true; 179 return true;
180 } 180 }
181 181
182 // Validate that claimed script resources actually exist. 182 // Validate that claimed script resources actually exist.
183 for (size_t i = 0; i < extension->content_scripts().size(); ++i) { 183 for (size_t i = 0; i < extension->content_scripts().size(); ++i) {
184 const UserScript& script = extension->content_scripts()[i]; 184 const UserScript& script = extension->content_scripts()[i];
185 185
186 for (size_t j = 0; j < script.js_scripts().size(); j++) { 186 for (size_t j = 0; j < script.js_scripts().size(); j++) {
187 const FilePath& path = 187 const UserScript::File& js_script = script.js_scripts()[j];
188 script.js_scripts()[j].resource().GetFilePath(); 188 const FilePath& path = ExtensionResource::GetFilePath(
189 js_script.extension_root(), js_script.relative_path());
189 if (path.empty()) { 190 if (path.empty()) {
190 *error = StringPrintf("Could not load '%s' for content script.", 191 *error = StringPrintf("Could not load '%s' for content script.",
191 WideToUTF8(path.ToWStringHack()).c_str()); 192 WideToUTF8(path.ToWStringHack()).c_str());
192 return false; 193 return false;
193 } 194 }
194 } 195 }
195 196
196 for (size_t j = 0; j < script.css_scripts().size(); j++) { 197 for (size_t j = 0; j < script.css_scripts().size(); j++) {
197 const FilePath& path = 198 const UserScript::File& css_script = script.css_scripts()[j];
198 script.css_scripts()[j].resource().GetFilePath(); 199 const FilePath& path = ExtensionResource::GetFilePath(
200 css_script.extension_root(), css_script.relative_path());
199 if (path.empty()) { 201 if (path.empty()) {
200 *error = StringPrintf("Could not load '%s' for content script.", 202 *error = StringPrintf("Could not load '%s' for content script.",
201 WideToUTF8(path.ToWStringHack()).c_str()); 203 WideToUTF8(path.ToWStringHack()).c_str());
202 return false; 204 return false;
203 } 205 }
204 } 206 }
205 } 207 }
206 208
207 // Validate claimed plugin paths. 209 // Validate claimed plugin paths.
208 for (size_t i = 0; i < extension->plugins().size(); ++i) { 210 for (size_t i = 0; i < extension->plugins().size(); ++i) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 "Filenames starting with \"_\" are reserved for use by the system.", 398 "Filenames starting with \"_\" are reserved for use by the system.",
397 filename.c_str()); 399 filename.c_str());
398 return false; 400 return false;
399 } 401 }
400 } 402 }
401 403
402 return true; 404 return true;
403 } 405 }
404 406
405 } // namespace extension_file_util 407 } // namespace extension_file_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698