| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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" |
| 11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/json/json_file_value_serializer.h" | 14 #include "base/json/json_file_value_serializer.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/extensions/api/extension_action/action_info.h" | 22 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_icon_set.h" | 24 #include "chrome/common/extensions/extension_icon_set.h" |
| 25 #include "chrome/common/extensions/extension_l10n_util.h" | 25 #include "chrome/common/extensions/extension_l10n_util.h" |
| 26 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 27 #include "chrome/common/extensions/extension_messages.h" | 26 #include "chrome/common/extensions/extension_messages.h" |
| 28 #include "chrome/common/extensions/manifest_handler.h" | 27 #include "chrome/common/extensions/manifest_handler.h" |
| 29 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 28 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 30 #include "chrome/common/extensions/manifest_handlers/theme_handler.h" | 29 #include "chrome/common/extensions/manifest_handlers/theme_handler.h" |
| 31 #include "chrome/common/extensions/message_bundle.h" | 30 #include "chrome/common/extensions/message_bundle.h" |
| 32 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
| 33 #include "extensions/common/extension_resource.h" | 32 #include "extensions/common/extension_resource.h" |
| 34 #include "extensions/common/install_warning.h" | 33 #include "extensions/common/install_warning.h" |
| 35 #include "extensions/common/manifest.h" | 34 #include "extensions/common/manifest.h" |
| 35 #include "extensions/common/manifest_constants.h" |
| 36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 37 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 38 #include "net/base/file_stream.h" | 38 #include "net/base/file_stream.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 40 | 40 |
| 41 using extensions::Extension; | 41 using extensions::Extension; |
| 42 using extensions::ExtensionResource; | 42 using extensions::ExtensionResource; |
| 43 using extensions::Manifest; | 43 using extensions::Manifest; |
| 44 | 44 |
| 45 namespace errors = extension_manifest_errors; | 45 namespace errors = extensions::manifest_errors; |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 const base::FilePath::CharType kTempDirectoryName[] = FILE_PATH_LITERAL("Temp"); | 49 const base::FilePath::CharType kTempDirectoryName[] = FILE_PATH_LITERAL("Temp"); |
| 50 | 50 |
| 51 // Add the image paths contained in the |icon_set| to |image_paths|. | 51 // Add the image paths contained in the |icon_set| to |image_paths|. |
| 52 void AddPathsFromIconSet(const ExtensionIconSet& icon_set, | 52 void AddPathsFromIconSet(const ExtensionIconSet& icon_set, |
| 53 std::set<base::FilePath>* image_paths) { | 53 std::set<base::FilePath>* image_paths) { |
| 54 // TODO(viettrungluu): These |FilePath::FromUTF8Unsafe()| indicate that we're | 54 // TODO(viettrungluu): These |FilePath::FromUTF8Unsafe()| indicate that we're |
| 55 // doing something wrong. | 55 // doing something wrong. |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 return base::FilePath(); | 566 return base::FilePath(); |
| 567 } | 567 } |
| 568 return temp_path; | 568 return temp_path; |
| 569 } | 569 } |
| 570 | 570 |
| 571 void DeleteFile(const base::FilePath& path, bool recursive) { | 571 void DeleteFile(const base::FilePath& path, bool recursive) { |
| 572 base::DeleteFile(path, recursive); | 572 base::DeleteFile(path, recursive); |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace extension_file_util | 575 } // namespace extension_file_util |
| OLD | NEW |