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

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

Issue 9150008: Introduce background.scripts feature for extension manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_file_util.h" 5 #include "chrome/common/extensions/extension_file_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 l10n_util::GetStringFUTF8( 285 l10n_util::GetStringFUTF8(
286 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, 286 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED,
287 UTF8ToUTF16(path)); 287 UTF8ToUTF16(path));
288 return false; 288 return false;
289 } 289 }
290 } 290 }
291 291
292 // Validate background page location, except for hosted apps, which should use 292 // Validate background page location, except for hosted apps, which should use
293 // an external URL. Background page for hosted apps are verified when the 293 // an external URL. Background page for hosted apps are verified when the
294 // extension is created (in Extension::InitFromValue) 294 // extension is created (in Extension::InitFromValue)
295 if (!extension->background_url().is_empty() && !extension->is_hosted_app()) { 295 if (extension->has_background_page() &&
296 !extension->is_hosted_app() &&
297 extension->background_scripts().empty()) {
296 FilePath page_path = ExtensionURLToRelativeFilePath( 298 FilePath page_path = ExtensionURLToRelativeFilePath(
297 extension->background_url()); 299 extension->GetBackgroundURL());
298 const FilePath path = extension->GetResource(page_path).GetFilePath(); 300 const FilePath path = extension->GetResource(page_path).GetFilePath();
299 if (path.empty() || !file_util::PathExists(path)) { 301 if (path.empty() || !file_util::PathExists(path)) {
300 *error = 302 *error =
301 l10n_util::GetStringFUTF8( 303 l10n_util::GetStringFUTF8(
302 IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, 304 IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED,
303 page_path.LossyDisplayName()); 305 page_path.LossyDisplayName());
304 return false; 306 return false;
305 } 307 }
306 } 308 }
307 309
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return temp_path; 683 return temp_path;
682 684
683 return FilePath(); 685 return FilePath();
684 } 686 }
685 687
686 void DeleteFile(const FilePath& path, bool recursive) { 688 void DeleteFile(const FilePath& path, bool recursive) {
687 file_util::Delete(path, recursive); 689 file_util::Delete(path, recursive);
688 } 690 }
689 691
690 } // namespace extension_file_util 692 } // namespace extension_file_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698