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 "chrome/browser/ui/webui/extensions/extension_loader_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_loader_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // error. Otherwise, we should still display the manifest (for consistency, | 117 // error. Otherwise, we should still display the manifest (for consistency, |
118 // reference, and so that if we ever make this really fancy and add an editor, | 118 // reference, and so that if we ever make this really fancy and add an editor, |
119 // it's ready). | 119 // it's ready). |
120 // | 120 // |
121 // This regex call can fail, but if it does, we just don't highlight anything. | 121 // This regex call can fail, but if it does, we just don't highlight anything. |
122 re2::RE2::FullMatch(error, regex, &line, &column); | 122 re2::RE2::FullMatch(error, regex, &line, &column); |
123 | 123 |
124 // This will read the manifest and call AddFailure with the read manifest | 124 // This will read the manifest and call AddFailure with the read manifest |
125 // contents. | 125 // contents. |
126 base::PostTaskWithTraitsAndReplyWithResult( | 126 base::PostTaskWithTraitsAndReplyWithResult( |
127 FROM_HERE, | 127 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, |
128 base::TaskTraits().MayBlock().WithPriority( | |
129 base::TaskPriority::USER_BLOCKING), | |
130 base::Bind(&ReadFileToString, extension_path.Append(kManifestFilename)), | 128 base::Bind(&ReadFileToString, extension_path.Append(kManifestFilename)), |
131 base::Bind(callback, extension_path, error, line)); | 129 base::Bind(callback, extension_path, error, line)); |
132 } | 130 } |
133 | 131 |
134 void ExtensionLoaderHandler::HandleRetry(const base::ListValue* args) { | 132 void ExtensionLoaderHandler::HandleRetry(const base::ListValue* args) { |
135 DCHECK(args->empty()); | 133 DCHECK(args->empty()); |
136 const base::FilePath file_path = failed_paths_.back(); | 134 const base::FilePath file_path = failed_paths_.back(); |
137 failed_paths_.pop_back(); | 135 failed_paths_.pop_back(); |
138 LoadUnpackedExtension(file_path); | 136 LoadUnpackedExtension(file_path); |
139 } | 137 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 NotifyFrontendOfFailure(); | 216 NotifyFrontendOfFailure(); |
219 } | 217 } |
220 | 218 |
221 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { | 219 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { |
222 web_ui()->CallJavascriptFunctionUnsafe( | 220 web_ui()->CallJavascriptFunctionUnsafe( |
223 "extensions.ExtensionLoader.notifyLoadFailed", failures_); | 221 "extensions.ExtensionLoader.notifyLoadFailed", failures_); |
224 failures_.Clear(); | 222 failures_.Clear(); |
225 } | 223 } |
226 | 224 |
227 } // namespace extensions | 225 } // namespace extensions |
OLD | NEW |