OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/utility/utility_handler.h" | 5 #include "extensions/utility/utility_handler.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 manifest.errors())); | 74 manifest.errors())); |
75 } else { | 75 } else { |
76 Send(new ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded( | 76 Send(new ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded( |
77 manifest.results())); | 77 manifest.results())); |
78 } | 78 } |
79 ReleaseProcessIfNeeded(); | 79 ReleaseProcessIfNeeded(); |
80 } | 80 } |
81 | 81 |
82 void UtilityHandler::OnUnzipToDir(const base::FilePath& zip_path, | 82 void UtilityHandler::OnUnzipToDir(const base::FilePath& zip_path, |
83 const base::FilePath& dir) { | 83 const base::FilePath& dir) { |
84 if (!zip::Unzip(zip_path, dir)) { | 84 const base::Callback<bool(const base::FilePath&)>& filter_cb = |
| 85 base::Bind(&Unpacker::ShouldExtractFile); |
| 86 // TODO(crbug.com/645263): This silently ignores blocked file types. |
| 87 // Add install warnings. |
| 88 if (!zip::UnzipWithFilterCallback(zip_path, dir, filter_cb)) { |
85 Send(new ExtensionUtilityHostMsg_UnzipToDir_Failed( | 89 Send(new ExtensionUtilityHostMsg_UnzipToDir_Failed( |
86 std::string(kExtensionHandlerUnzipError))); | 90 std::string(kExtensionHandlerUnzipError))); |
87 } else { | 91 } else { |
88 Send(new ExtensionUtilityHostMsg_UnzipToDir_Succeeded(dir)); | 92 Send(new ExtensionUtilityHostMsg_UnzipToDir_Succeeded(dir)); |
89 } | 93 } |
90 | 94 |
91 ReleaseProcessIfNeeded(); | 95 ReleaseProcessIfNeeded(); |
92 } | 96 } |
93 | 97 |
94 void UtilityHandler::OnUnpackExtension(const base::FilePath& directory_path, | 98 void UtilityHandler::OnUnpackExtension(const base::FilePath& directory_path, |
(...skipping 11 matching lines...) Expand all Loading... |
106 *unpacker.parsed_manifest())); | 110 *unpacker.parsed_manifest())); |
107 } else { | 111 } else { |
108 Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed( | 112 Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed( |
109 unpacker.error_message())); | 113 unpacker.error_message())); |
110 } | 114 } |
111 ReleaseProcessIfNeeded(); | 115 ReleaseProcessIfNeeded(); |
112 } | 116 } |
113 | 117 |
114 | 118 |
115 } // namespace extensions | 119 } // namespace extensions |
OLD | NEW |