| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 l10n_util::GetStringFUTF8( | 284 l10n_util::GetStringFUTF8( |
| 285 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, | 285 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, |
| 286 UTF8ToUTF16(path)); | 286 UTF8ToUTF16(path)); |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Validate background page location, except for hosted apps, which should use | 291 // Validate background page location, except for hosted apps, which should use |
| 292 // an external URL. Background page for hosted apps are verified when the | 292 // an external URL. Background page for hosted apps are verified when the |
| 293 // extension is created (in Extension::InitFromValue) | 293 // extension is created (in Extension::InitFromValue) |
| 294 if (!extension->background_url().is_empty() && !extension->is_hosted_app()) { | 294 if (extension->has_background_page() && |
| 295 !extension->is_hosted_app() && |
| 296 extension->background_scripts().empty()) { |
| 295 FilePath page_path = ExtensionURLToRelativeFilePath( | 297 FilePath page_path = ExtensionURLToRelativeFilePath( |
| 296 extension->background_url()); | 298 extension->GetBackgroundURL()); |
| 297 const FilePath path = extension->GetResource(page_path).GetFilePath(); | 299 const FilePath path = extension->GetResource(page_path).GetFilePath(); |
| 298 if (path.empty() || !file_util::PathExists(path)) { | 300 if (path.empty() || !file_util::PathExists(path)) { |
| 299 *error = | 301 *error = |
| 300 l10n_util::GetStringFUTF8( | 302 l10n_util::GetStringFUTF8( |
| 301 IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, | 303 IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, |
| 302 page_path.LossyDisplayName()); | 304 page_path.LossyDisplayName()); |
| 303 return false; | 305 return false; |
| 304 } | 306 } |
| 305 } | 307 } |
| 306 | 308 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 return temp_path; | 667 return temp_path; |
| 666 | 668 |
| 667 return FilePath(); | 669 return FilePath(); |
| 668 } | 670 } |
| 669 | 671 |
| 670 void DeleteFile(const FilePath& path, bool recursive) { | 672 void DeleteFile(const FilePath& path, bool recursive) { |
| 671 file_util::Delete(path, recursive); | 673 file_util::Delete(path, recursive); |
| 672 } | 674 } |
| 673 | 675 |
| 674 } // namespace extension_file_util | 676 } // namespace extension_file_util |
| OLD | NEW |